@@ -13,12 +13,24 @@ import Servant.API.TypeLevel
1313-- | On the left hand side of 'IsElem' and 'Prune',
1414-- @UVerb ... ... '[Wild]@ will match any return result type.
1515data Wild
16+type instance IsElem' (Verb m s ct Wild) (Verb m s ct' _) = IsSubList ct ct'
1617type instance IsElem' (UVerb m ct '[Wild]) (Verb m s ct' _) = IsSubList ct ct'
1718type instance IsElem' (UVerb m ct '[Wild]) (UVerb m ct' _) = IsSubList ct ct'
1819
19−type instance IsElem' sa (Description _ :> sb) = IsElem sa sb
20−type instance IsElem' sa (AuthProtect _ :> sb) = IsElem sa sb
21−type instance IsElem' sa (QueryParam' _ _ _ :> sb) = IsElem sa sb
20+-- things that have 'HasLink' instances but not 'IsElem' instances
21+type instance IsElem' (Capture' _ y :> sa) (Capture' x y :> sb) = IsElem sa sb
22+type instance IsElem' sa (HttpVersion :> sb) = IsElem sa sb
23+type instance IsElem' sa (Vault :> sb) = IsElem sa sb
24+type instance IsElem' sa (BasicAuth _ _ :> sb) = IsElem sa sb
25+type instance IsElem' sa (Description _ :> sb) = IsElem sa sb
26+type instance IsElem' sa (Summary _ :> sb) = IsElem sa sb
27+type instance IsElem' sa (AuthProtect _ :> sb) = IsElem sa sb
28+type instance IsElem' sa (IsSecure :> sb) = IsElem sa sb
29+type instance IsElem' sa (Header' _ _ _ :> sb) = IsElem sa sb
30+type instance IsElem' sa (QueryParam' _ _ _ :> sb) = IsElem sa sb
31+type instance IsElem' sa (RemoteHost :> sb) = IsElem sa sb
32+type instance IsElem' sa (ReqBody' _ _ _ :> sb) = IsElem sa sb
33+type instance IsElem' sa (StreamBody' _ _ _ _ :> sb) = IsElem sa sb
2234
2335-- | Restrict the API in @api@ to the endpoints in @mask@. This works similarly
2436-- to 'IsElem' in that the @mask@ doesn't have to specify non-path parameters.
@@ -28,17 +40,25 @@ type family Prune (mask :: Type) (api :: Type) :: Type where
2840 -- The instances mimic 'IsElem' and the 'IsElem'' instances above
2941 Prune sa (sb :<|> sc) = Prune sa sb ?<|> Prune sa sc
3042 Prune (e :> sa) (e :> sb) = e ?> Prune sa sb
31− Prune sa (Header sym x :> sb) = Header sym x ?> Prune sa sb
32− Prune sa (ReqBody y x :> sb) = ReqBody y x ?> Prune sa sb
33− Prune (CaptureAll z y :> sa) (CaptureAll x y :> sb) = CaptureAll x y ?> Prune sa sb
34− Prune (Capture z y :> sa) (Capture x y :> sb) = Capture x y ?> Prune sa sb
35− Prune sa (QueryParam' x y z :> sb) = QueryParam' x y z ?> Prune sa sb
36− Prune sa (QueryParams x y :> sb) = QueryParams x y ?> Prune sa sb
37− Prune sa (QueryFlag x :> sb) = QueryFlag x ?> Prune sa sb
38− Prune sa (Fragment x :> sb) = Fragment x ?> Prune sa sb
39− Prune sa (Description x :> sb) = Description x ?> Prune sa sb
40− Prune sa (AuthProtect x :> sb) = AuthProtect x ?> Prune sa sb
43+ Prune (CaptureAll _ y :> sa) (CaptureAll x y :> sb) = CaptureAll x y ?> Prune sa sb
44+ Prune (Capture' _ _ z :> sa) (Capture' x y z :> sb) = Capture' x y z ?> Prune sa sb
45+ Prune sa (HttpVersion :> sb) = HttpVersion ?> Prune sa sb
46+ Prune sa (Vault :> sb) = Vault ?> Prune sa sb
47+ Prune sa (BasicAuth x y :> sb) = BasicAuth x y ?> Prune sa sb
48+ Prune sa (Description x :> sb) = Description x ?> Prune sa sb
49+ Prune sa (Summary x :> sb) = Summary x ?> Prune sa sb
50+ Prune sa (AuthProtect x :> sb) = AuthProtect x ?> Prune sa sb
51+ Prune sa (Fragment x :> sb) = Fragment x ?> Prune sa sb
52+ Prune sa (IsSecure :> sb) = IsSecure ?> Prune sa sb
53+ Prune sa (Header' x y z :> sb) = Header' x y z ?> Prune sa sb
54+ Prune sa (QueryFlag x :> sb) = QueryFlag x ?> Prune sa sb
55+ Prune sa (QueryParams x y :> sb) = QueryParams x y ?> Prune sa sb
56+ Prune sa (QueryParam' x y z :> sb) = QueryParam' x y z ?> Prune sa sb
57+ Prune sa (RemoteHost :> sb) = RemoteHost ?> Prune sa sb
58+ Prune sa (ReqBody' x y z :> sb) = ReqBody' x y z ?> Prune sa sb
59+ Prune sa (StreamBody' x y z w :> sb) = StreamBody' x y z w ?> Prune sa sb
4160 Prune (Verb m s ct typ) (Verb m s ct typ) = Verb m s ct typ
61+ Prune (Verb m s ct Wild) (Verb m s ct typ) = Verb m s ct typ
4262 Prune (UVerb m ct typs) (UVerb m ct typs) = UVerb m ct typs
4363 Prune (UVerb m ct '[Wild]) (Verb m s ct typ) = Verb m s ct typ
4464 Prune (UVerb m ct '[Wild]) (UVerb m ct typs) = UVerb m ct typs