git.iko.soy/typeable/servant
on master help sign in
Fix loop in IsSubList
b20edfdJulian K. Arni
servant/src/Servant/Utils/Links.hs+5−4
@@ -180,12 +180,13 @@ type family IsElem endpoint api :: Constraint where
180 IsElem e e = ()
180 IsElem e e = ()
181 IsElem e a = IsElem' e a
181 IsElem e a = IsElem' e a
182
182
183−
184type family IsSubList a b :: Constraint where
183type family IsSubList a b :: Constraint where
185 IsSubList '[] b = ()
184 IsSubList '[] b = ()
186− IsSubList '[x] (x ': xs) = ()
185+ IsSubList (x ': xs) y = Elem x y `And` IsSubList xs y
187− IsSubList '[x] (y ': ys) = IsSubList '[x] ys
186+
188− IsSubList (x ': xs) y = IsSubList '[x] y `And` IsSubList xs y
187+type family Elem e es :: Constraint where
188+ Elem x (x ': xs) = ()
189+ Elem y (x ': xs) = Elem y xs
189
190
190-- Phantom types for Param
191-- Phantom types for Param
191data Query
192data Query