@@ -35,14 +35,10 @@ module TypeFun.Data.List
3535 , UnionList
3636 , AppendUniq
3737 , Intersect
38− , Substract
3938 -- * Uniqueness checking
4039 , ElementIsUniq
4140 , UniqElements
4241 , UniqElements'
43− -- * Unsafe helpers
44− , appendId
45− , subListId
4642 ) where
4743
4844import Data.Type.Bool
@@ -51,7 +47,6 @@ import GHC.TypeLits
5147import TypeFun.Data.Eq
5248import TypeFun.Data.Maybe
5349import TypeFun.Data.Peano
54−import Unsafe.Coerce
5550
5651------------------------------------------------------------------------
5752-- NOTE: Errors type classes. These type classes are not in separate --
@@ -108,13 +103,6 @@ type family (:++:) (a :: [k]) (b :: [k]) :: [k] where
108103 '[] :++: b = b
109104 (a ': as) :++: b = a ': (as :++: b)
110105
111−appendId
112− :: forall proxy l r
113− . proxy l
114− -> (l ~ (l :++: '[]) => r)
115− -> r
116−appendId = unsafeCoerce id
117−
118106type IndexOf a s = FromJust (IndexOfMay a s)
119107
120108type IndexOfMay a s = IndexOfMay' Z a s
@@ -168,12 +156,6 @@ type family SubList (a :: [k]) (b :: [k]) :: Constraint where
168156 SubList '[] bs = ()
169157 SubList (a ': as) bs = (Elem a bs, SubList as bs)
170158
171−subListId
172− :: forall proxy l r
173− . proxy l
174− -> (SubList l l => r) -> r
175−subListId _ = unsafeCoerce id
176−
177159type family NotSubList (a :: [k]) (b :: [k]) :: Constraint where
178160 NotSubList '[] bs = ()
179161 NotSubList (a ': as) bs = (NotElem a bs, NotSubList as bs)
@@ -213,12 +195,6 @@ type family AppendUniq (a :: k) (s :: [k]) :: [k] where
213195-- taken from first list
214196type Intersect a b = (Indices (CatMaybes (IndicesOfMay a b)) b)
215197
216−-- | Removes from first list all elements occured in second
217−type family Substract (a :: [k]) (b :: [k]) :: [k] where
218− Substract '[] b = '[]
219− Substract a '[] = a
220− Substract a (b ': bs) = Substract (Delete b a) bs
221−
222198-- | Checks that element 'a' occurs in a list just once
223199type ElementIsUniq a s = If (Equal (S Z) (Count a s))
224200 (() :: Constraint)