packages feed

type-list 0.2.0.0 → 0.3.0.0

raw patch · 3 files changed

+42/−9 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Data.Type.List: ZipWith' :: ZipWith' f xs ys
+ Data.Type.List: ZipWith'' :: ZipWith'' f xs
+ Data.Type.List: ZipWith''' :: ZipWith''' f
+ Data.Type.List: data ZipWith' :: (TyFun a (TyFun b c -> *) -> *) -> [a] -> TyFun [b] [c] -> *
+ Data.Type.List: data ZipWith'' :: (TyFun a (TyFun b c -> *) -> *) -> TyFun [a] (TyFun [b] [c] -> *) -> *
+ Data.Type.List: data ZipWith''' :: TyFun (TyFun a (TyFun b c -> *) -> *) (TyFun [a] (TyFun [b] [c] -> *) -> *) -> *

Files

+ README.md view
@@ -0,0 +1,2 @@+# type-list+Type-level list operations
src/Data/Type/List.hs view
@@ -26,7 +26,6 @@  import GHC.TypeLits import Data.Type.Bool-import Data.Type.Equality import Data.Singletons  -- |Maps a curried type function over a type list.@@ -43,11 +42,31 @@ type instance Apply Map'' f = Map' f type instance Apply (Map' f) l = Map f l +-- |Zip two list with a curried two-argument type function.+type family ZipWith (f :: TyFun a (TyFun b c -> *) -> *) (xs :: [a]) (ys :: [b]) where+    ZipWith f '[] '[] = '[]+    ZipWith f (x ': xs) (y ': ys) = (Apply (Apply f x) y) ': ZipWith f xs ys++data ZipWith''' :: TyFun (TyFun a (TyFun b c -> *) -> *) (TyFun [a] (TyFun [b] [c] -> *) -> *) -> * where+  ZipWith''' :: ZipWith''' f++data ZipWith'' :: (TyFun a (TyFun b c -> *) -> *) -> TyFun [a] (TyFun [b] [c] -> *) -> * where+  ZipWith'' :: ZipWith'' f xs++data ZipWith' :: (TyFun a (TyFun b c -> *) -> *) -> [a] -> TyFun [b] [c] -> * where+  ZipWith' :: ZipWith' f xs ys++type instance Apply ZipWith''' f = ZipWith'' f+type instance Apply (ZipWith'' f) xs = ZipWith' f xs+type instance Apply (ZipWith' f xs) ys = ZipWith f xs ys++-- | Length of a type-level list, as a type-level natural number. type family Length xs where     Length '[] = 0     Length (x ': xs) = 1 + (Length xs)  lengthVal :: forall sing xs. KnownNat (Length xs) => sing xs -> Integer+-- ^Length of a type-level list, as an integer. lengthVal _ = natVal (undefined :: proxy (Length xs))  data Length' :: TyFun [a] Nat -> * where@@ -99,6 +118,7 @@ type instance Apply Remove'' x = Remove' x type instance Apply (Remove' x) xs = Remove x xs +-- |Set difference over type lists. type family Difference xs ys where     Difference '[] ys = ys     Difference (x ': xs) ys = Remove x (Difference xs ys)@@ -112,10 +132,12 @@ type instance Apply Difference'' xs = Difference' xs type instance Apply (Difference' xs) ys = Difference xs ys +-- |Helper type family for 'Reverse'. type family ReverseAcc xs acc where     ReverseAcc '[] acc = acc     ReverseAcc (x ': xs) acc = ReverseAcc xs (x ': acc) +-- |Reverse a type-level list. type family Reverse xs where     Reverse xs = ReverseAcc xs '[] @@ -126,8 +148,8 @@  -- | Type list membership test. type family Find x ys where-    Find x '[]       = False-    Find x (x ': ys) = True+    Find x '[]       = 'False+    Find x (x ': ys) = 'True     Find x (y ': ys) = Find x ys  data Find'' :: TyFun k (TyFun [k] Bool -> *) -> * where@@ -156,7 +178,7 @@  -- |Test if two list do not contain any equal elements. type family Distinct xs ys where-    Distinct '[] '[] = False+    Distinct '[] '[] = 'False     Distinct (x ': xs) (x ': ys) = Distinct xs ys     Distinct (x ': xs) (y ': ys) = Not (Find x (y ': ys)) && Distinct xs ys @@ -234,5 +256,4 @@     Swap' :: Swap' f  type instance Apply Swap' '(a,b) = Swap '(a,b)- 
type-list.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                type-list-version:             0.2.0.0+version:             0.3.0.0 synopsis:            Operations on type-level lists and tuples. description:         Operations on type-level lists and tuples, together with their curried versions. license:             BSD3@@ -12,17 +12,27 @@ -- copyright:            category:            Data build-type:          Simple--- extra-source-files:  +extra-source-files:  README.md+tested-with:         GHC == 7.8.4+                   , GHC == 7.10.1+                   , GHC == 7.10.2 cabal-version:       >=1.10 source-repository    head     type: git     location: https://github.com/marcinmrotek/type-list +flag devel+  description:  "Development mode (-Werror)"+  default:      False+  manual:       True+ library   exposed-modules:     Data.Type.List-  -- other-modules:       -  -- other-extensions:       build-depends:       base >=4.7 && <4.9                       ,singletons >= 1.0 && < 1.2   hs-source-dirs:      src   default-language:    Haskell2010+  ghc-options:         -Wall +  if flag(devel)+    ghc-options:       -Werror+