Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- type family EndpointsList api where ...
- type family IsSubAPI sub api :: Constraint where ...
- type family AllIsElem xs api :: Constraint where ...
- type family MapSub e xs where ...
- type family AppendList xs ys where ...
- type family Or (a :: Constraint) (b :: Constraint) :: Constraint where ...
- type family IsIn sub api :: Constraint where ...
- type family Elem x xs where ...
- type family Nub xs where ...
- type family Remove x xs where ...
- type BodyTypes c api = Nub (BodyTypes' c api)
- type AddBodyType c cs a as = If (Elem c cs) (a ': as) as
- type family BodyTypes' c api :: [*] where ...
Documentation
type family EndpointsList api where ... Source #
Build a list of endpoints from an API.
EndpointsList (a :<|> b) = AppendList (EndpointsList a) (EndpointsList b) | |
EndpointsList (e :> a) = MapSub e (EndpointsList a) | |
EndpointsList a = '[a] |
type family IsSubAPI sub api :: Constraint where ... Source #
Check whether sub
is a sub API of api
.
IsSubAPI sub api = AllIsElem (EndpointsList sub) api |
type family AllIsElem xs api :: Constraint where ... Source #
Check that every element of xs
is an endpoint of api
.
type family AppendList xs ys where ... Source #
Append two type-level lists.
AppendList '[] ys = ys | |
AppendList (x ': xs) ys = x ': AppendList xs ys |
type family Or (a :: Constraint) (b :: Constraint) :: Constraint where ... Source #
type family IsIn sub api :: Constraint where ... Source #
type family Elem x xs where ... Source #
Check whether a type is a member of a list of types.
This is a type-level analogue of
.elem
type BodyTypes c api = Nub (BodyTypes' c api) Source #
Extract a list of unique "body" types for a specific content-type from a servant API.
type AddBodyType c cs a as = If (Elem c cs) (a ': as) as Source #
adds type AddBodyType
c cs a asa
to the list as
only if c
is in cs
.
type family BodyTypes' c api :: [*] where ... Source #
Extract a list of "body" types for a specific content-type from a servant API.
To extract unique types see
.BodyTypes
BodyTypes' c (Verb verb b cs (Headers hdrs a)) = AddBodyType c cs a '[] | |
BodyTypes' c (Verb verb b cs a) = AddBodyType c cs a '[] | |
BodyTypes' c (ReqBody' mods cs a :> api) = AddBodyType c cs a (BodyTypes' c api) | |
BodyTypes' c (e :> api) = BodyTypes' c api | |
BodyTypes' c (a :<|> b) = AppendList (BodyTypes' c a) (BodyTypes' c b) | |
BodyTypes' c api = '[] |