add TypeFun.Constraint
commitb790b611e675fbd735e5018b93a18eaf9f7ee5ea
authorAleksey Uimanov <s9gf4ult@gmail.com>
dateSat 24 Oct 2015, 22:37 (11 years ago)
parenta674eb9
src/TypeFun/Constraint.hsnew file+7
@@ -0,0 +1,7 @@
1+module TypeFun.Constraint where
2+
3+import GHC.Exts
4+
5+type family AllSatisfy (c :: k -> Constraint) (s :: [k]) :: Constraint where
6+ AllSatisfy c '[] = ()
7+ AllSatisfy c (a ': as) = (c a, AllSatisfy c as)
src/TypeFun/Data/List.hs+5
@@ -89,3 +89,8 @@ type family Take (c :: N) (s :: [k]) :: [k] where
8989 Take 'Z s = '[]
9090 Take ('S c) '[] = '[]
9191 Take ('S c) (a ': as) = a ': (Take c as)
92+
93+type family Delete (a :: k) (s :: [k]) :: [k] where
94+ Delete a '[] = '[]
95+ Delete a (a ': as) = Delete a as
96+ Delete a (b ': as) = b ': (Delete a as)
type-fun.cabal+2−1
@@ -28,7 +28,8 @@ library
2828 , TypeOperators
2929 , UndecidableInstances
3030
31− exposed-modules: TypeFun.Data.Eq
31+ exposed-modules: TypeFun.Constraint
32+ , TypeFun.Data.Eq
3233 , TypeFun.Data.List
3334 , TypeFun.Data.Maybe
3435 , TypeFun.Data.Peano