on master help sign in
Merge pull request #95 from haskell-servant/tvh/safeLink-92

More strict matching for Capture (safeLink)

commitde813c326980c6be8061734339ee4a3f4ba8c8a1 authorJulian Arni <jkarni@gmail.com> dateWed 27 May 2015, 13:27 (11 years ago) parent0a6e2aa0f4c73b
1 file changed+3−3
servant/src/Servant/Utils/Links.hs+3−3
servant/src/Servant/Utils/Links.hs+3−3
@@ -72,8 +72,7 @@
7272--
7373-- >>> let bad_link = Proxy :: Proxy ("hello" :> Delete '[JSON] ())
7474-- >>> safeLink api bad_link
75−-- <BLANKLINE>
76−-- <interactive>:64:1:
75+-- ...
7776-- Could not deduce (Or
7877-- (IsElem' (Delete '[JSON] ()) (Get '[JSON] Int))
7978-- (IsElem'
@@ -168,7 +167,8 @@ type family IsElem endpoint api :: Constraint where
168167 IsElem (e :> sa) (e :> sb) = IsElem sa sb
169168 IsElem sa (Header x :> sb) = IsElem sa sb
170169 IsElem sa (ReqBody y x :> sb) = IsElem sa sb
171− IsElem (e :> sa) (Capture x y :> sb) = IsElem sa sb
170+ IsElem (Capture z y :> sa) (Capture x y :> sb)
171+ = IsElem sa sb
172172 IsElem sa (QueryParam x y :> sb) = IsElem sa sb
173173 IsElem sa (QueryParams x y :> sb) = IsElem sa sb
174174 IsElem sa (QueryFlag x :> sb) = IsElem sa sb