@@ -136,6 +136,10 @@ type family Or (a :: Constraint) (b :: Constraint) :: Constraint where
136136 Or () b = ()
137137 Or a () = ()
138138
139+-- | If both a or b produce an empty constraint, produce an empty constraint.
140+type family And (a :: Constraint) (b :: Constraint) :: Constraint where
141+ And () () = ()
142+
139143-- | You may use this type family to tell the type checker that your custom type
140144-- may be skipped as part of a link. This is useful for things like
141145-- 'QueryParam' that are optional in a URI and do not affect them if they are
@@ -164,29 +168,19 @@ type family IsElem endpoint api :: Constraint where
164168 IsElem sa (MatrixParam x y :> sb) = IsElem sa sb
165169 IsElem sa (MatrixParams x y :> sb) = IsElem sa sb
166170 IsElem sa (MatrixFlag x :> sb) = IsElem sa sb
167− IsElem e e = ()
168− IsElem e a = IsElem' e a
169171 IsElem (Get ct typ) (Get ct' typ) = IsSubList ct ct'
170172 IsElem (Post ct typ) (Post ct' typ) = IsSubList ct ct'
171173 IsElem (Put ct typ) (Put ct' typ) = IsSubList ct ct'
172− IsElem e e = 'True
173− IsElem e a = 'False
174+ IsElem e e = ()
175+ IsElem e a = IsElem' e a
174176
175177
176−type family IsSubList a b where
177− IsSubList '[] b = 'True
178− IsSubList '[x] (x ': xs) = 'True
178+type family IsSubList a b :: Constraint where
179+ IsSubList '[] b = ()
180+ IsSubList '[x] (x ': xs) = ()
179181 IsSubList '[x] (y ': ys) = IsSubList '[x] ys
180182 IsSubList (x ': xs) y = IsSubList '[x] y `And` IsSubList xs y
181− IsSubList a b = 'False
182−
183−type family IsLink'' l where
184− IsLink'' (e :> Get cts x) = IsLink' e
185− IsLink'' (e :> Post cts x) = IsLink' e
186− IsLink'' (e :> Put cts x) = IsLink' e
187− IsLink'' (e :> Delete) = IsLink' e
188− IsLink'' a = 'False
189−
183+ IsSubList a b = 'True ~ 'False
190184
191185-- Phantom types for Param
192186data Matrix
@@ -343,7 +337,7 @@ instance HasLink (Get y r) where
343337 type MkLink (Get y r) = URI
344338 toLink _ = linkURI
345339
346−instance HasLink (Post r) where
340+instance HasLink (Post y r) where
347341 type MkLink (Post y r) = URI
348342 toLink _ = linkURI
349343