From b20edfd96a9b62f5dadaba9772adb8abe0a3691d Mon Sep 17 00:00:00 2001 From: "Julian K. Arni" Date: Wed, 16 Dec 2015 13:41:18 +0100 Subject: [PATCH] Fix loop in IsSubList See #293. --- servant/src/Servant/Utils/Links.hs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/servant/src/Servant/Utils/Links.hs b/servant/src/Servant/Utils/Links.hs index b83d1178..b6bf7137 100644 --- a/servant/src/Servant/Utils/Links.hs +++ b/servant/src/Servant/Utils/Links.hs @@ -180,12 +180,13 @@ type family IsElem endpoint api :: Constraint where IsElem e e = () IsElem e a = IsElem' e a - type family IsSubList a b :: Constraint where IsSubList '[] b = () - IsSubList '[x] (x ': xs) = () - IsSubList '[x] (y ': ys) = IsSubList '[x] ys - IsSubList (x ': xs) y = IsSubList '[x] y `And` IsSubList xs y + IsSubList (x ': xs) y = Elem x y `And` IsSubList xs y + +type family Elem e es :: Constraint where + Elem x (x ': xs) = () + Elem y (x ': xs) = Elem y xs -- Phantom types for Param data Query