packages feed

tuple-hlist 0.1.0.2 → 0.1.0.3

raw patch · 4 files changed

+17/−16 lines, 4 files

Files

Makefile view
@@ -1,7 +1,7 @@ script = Tools/generateInstances.hs incomplete_source = Tools/IncompleteHList.hs instances_number = 15-result_dir = Data/Tuple+result_dir = src/Data/Tuple result = $(result_dir)/HList.hs  .PHONY: all
Tools/IncompleteHList.hs view
@@ -2,17 +2,20 @@ {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE TypeOperators #-}--- This module contains overloaded functions for creating an HList from a tuple--- or a tuple from an HList.--- The /toHList/ function creates an HList from a tuple.--- The /fromHList/ function creates a tuple from an HList.++{- |+This module contains overloaded functions for creating an HList from a tuple or+a tuple from an HList.+-} module HList (HLst(toHList, fromHList)) where  import Data.Tuple.OneTuple (OneTuple(OneTuple)) import Data.HList (HNil(HNil), HCons(HCons), (:*:), hEnd, hBuild)  class HLst a b | a -> b where+    -- |Creates an HList from a tuple.     toHList   :: a -> b+    -- |Creates a tuple from an HList.     fromHList :: b -> a  instance HLst (OneTuple a1) (a1 :*: HNil) where
src/Data/Tuple/HList.hs view
@@ -2,27 +2,25 @@ {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE TypeOperators #-}--- This module contains overloaded functions for creating an HList from a tuple--- or a tuple from an HList.--- The /toHList/ function creates an HList from a tuple.--- The /fromHList/ function creates a tuple from an HList.-module Data.Tuple.HList (HLst(toHList, fromHList)) where +{- |+This module contains overloaded functions for creating an HList from a tuple or+a tuple from an HList.+-}+module HList (HLst(toHList, fromHList)) where+ import Data.Tuple.OneTuple (OneTuple(OneTuple)) import Data.HList (HNil(HNil), HCons(HCons), (:*:), hEnd, hBuild)  class HLst a b | a -> b where+    -- |Creates an HList from a tuple.     toHList   :: a -> b+    -- |Creates a tuple from an HList.     fromHList :: b -> a - instance HLst (OneTuple a1) (a1 :*: HNil) where     toHList   (OneTuple a1)   = hEnd $ hBuild a1     fromHList (HCons a1 HNil) = OneTuple a1----snip---------------------- Machine generated code below, see Tools/MkTuple.hs----- mkTuple hlist 15 instance HLst (a1, a2) (a1 :*: a2 :*: HNil) where     toHList (a1, a2) = hEnd $ hBuild a1 a2     fromHList (HCons a1 (HCons a2 HNil)) = (a1, a2)
tuple-hlist.cabal view
@@ -1,5 +1,5 @@ name:                tuple-hlist-version:             0.1.0.2+version:             0.1.0.3 synopsis:            Functions to convert between tuples and HLists. description:         Functions to convert between tuples and HLists, overloaded on tuple size. homepage:            http://github.com/dudebout/tuple-hlist