@@ -35,6 +35,7 @@ module TypeFun.Data.List
35 , UnionList
35 , UnionList
36 , AppendUniq
36 , AppendUniq
37 , Intersect
37 , Intersect
38 -- * Uniqueness checking
39 -- * Uniqueness checking
39 , ElementIsUniq
40 , ElementIsUniq
40 , UniqElements
41 , UniqElements
@@ -195,6 +196,12 @@ type family AppendUniq (a :: k) (s :: [k]) :: [k] where
195-- taken from first list
196-- taken from first list
196type Intersect a b = (Indices (CatMaybes (IndicesOfMay a b)) b)
197type Intersect a b = (Indices (CatMaybes (IndicesOfMay a b)) b)
199+-- | Removes from first list all elements occured in second
200+type family Substract (a :: [k]) (b :: [k]) :: [k] where
201+ Substract '[] b = '[]
203+ Substract a (b ': bs) = Substract (Delete b a) bs
198-- | Checks that element 'a' occurs in a list just once
205-- | Checks that element 'a' occurs in a list just once
199type ElementIsUniq a s = If (Equal (S Z) (Count a s))
206type ElementIsUniq a s = If (Equal (S Z) (Count a s))
200 (() :: Constraint)
207 (() :: Constraint)