@@ -35,14 +35,10 @@ module TypeFun.Data.List
35 , UnionList
35 , UnionList
36 , AppendUniq
36 , AppendUniq
37 , Intersect
37 , Intersect
39 -- * Uniqueness checking
38 -- * Uniqueness checking
40 , ElementIsUniq
39 , ElementIsUniq
41 , UniqElements
40 , UniqElements
42 , UniqElements'
41 , UniqElements'
48import Data.Type.Bool
44import Data.Type.Bool
@@ -51,7 +47,6 @@ import GHC.TypeLits
51import TypeFun.Data.Eq
47import TypeFun.Data.Eq
52import TypeFun.Data.Maybe
48import TypeFun.Data.Maybe
53import TypeFun.Data.Peano
49import TypeFun.Data.Peano
56------------------------------------------------------------------------
51------------------------------------------------------------------------
57-- NOTE: Errors type classes. These type classes are not in separate --
52-- NOTE: Errors type classes. These type classes are not in separate --
@@ -108,13 +103,6 @@ type family (:++:) (a :: [k]) (b :: [k]) :: [k] where
108 '[] :++: b = b
103 '[] :++: b = b
109 (a ': as) :++: b = a ': (as :++: b)
104 (a ': as) :++: b = a ': (as :++: b)
114− -> (l ~ (l :++: '[]) => r)
116−appendId = unsafeCoerce id
118type IndexOf a s = FromJust (IndexOfMay a s)
106type IndexOf a s = FromJust (IndexOfMay a s)
120type IndexOfMay a s = IndexOfMay' Z a s
108type IndexOfMay a s = IndexOfMay' Z a s
@@ -168,12 +156,6 @@ type family SubList (a :: [k]) (b :: [k]) :: Constraint where
168 SubList '[] bs = ()
156 SubList '[] bs = ()
169 SubList (a ': as) bs = (Elem a bs, SubList as bs)
157 SubList (a ': as) bs = (Elem a bs, SubList as bs)
174− -> (SubList l l => r) -> r
175−subListId _ = unsafeCoerce id
177type family NotSubList (a :: [k]) (b :: [k]) :: Constraint where
159type family NotSubList (a :: [k]) (b :: [k]) :: Constraint where
178 NotSubList '[] bs = ()
160 NotSubList '[] bs = ()
179 NotSubList (a ': as) bs = (NotElem a bs, NotSubList as bs)
161 NotSubList (a ': as) bs = (NotElem a bs, NotSubList as bs)
@@ -213,12 +195,6 @@ type family AppendUniq (a :: k) (s :: [k]) :: [k] where
213-- taken from first list
195-- taken from first list
214type Intersect a b = (Indices (CatMaybes (IndicesOfMay a b)) b)
196type Intersect a b = (Indices (CatMaybes (IndicesOfMay a b)) b)
216−-- | Removes from first list all elements occured in second
217−type family Substract (a :: [k]) (b :: [k]) :: [k] where
218− Substract '[] b = '[]
220− Substract a (b ': bs) = Substract (Delete b a) bs
222-- | Checks that element 'a' occurs in a list just once
198-- | Checks that element 'a' occurs in a list just once
223type ElementIsUniq a s = If (Equal (S Z) (Count a s))
199type ElementIsUniq a s = If (Equal (S Z) (Count a s))
224 (() :: Constraint)
200 (() :: Constraint)