servant-0.13: A family of combinators for defining webservices APIs

Safe HaskellSafe
LanguageHaskell2010

Servant.API.Description

Contents

Synopsis

Combinators

data Description (sym :: Symbol) Source #

Add more verbose description for (part of) API.

Example:

>>> :{
type MyApi = Description
 "This comment is visible in multiple Servant interpretations \
 \and can be really long if necessary. \
 \Haskell multiline support is not perfect \
 \but it's still very readable."
:> Get '[JSON] Book
:}

Instances

HasLink * sub => HasLink * ((:>) * (Description s) sub) Source # 

Associated Types

type MkLink ((* :> Description s) sub) (endpoint :: (* :> Description s) sub) :: * Source #

Methods

toLink :: Proxy ((* :> Description s) sub) endpoint -> Link -> MkLink ((* :> Description s) sub) endpoint Source #

type MkLink * ((:>) * (Description s) sub) Source # 
type MkLink * ((:>) * (Description s) sub) = MkLink * sub

data Summary (sym :: Symbol) Source #

Add a short summary for (part of) API.

Example:

>>> type MyApi = Summary "Get book by ISBN." :> "books" :> Capture "isbn" Text :> Get '[JSON] Book

Instances

HasLink * sub => HasLink * ((:>) * (Summary s) sub) Source # 

Associated Types

type MkLink ((* :> Summary s) sub) (endpoint :: (* :> Summary s) sub) :: * Source #

Methods

toLink :: Proxy ((* :> Summary s) sub) endpoint -> Link -> MkLink ((* :> Summary s) sub) endpoint Source #

type MkLink * ((:>) * (Summary s) sub) Source # 
type MkLink * ((:>) * (Summary s) sub) = MkLink * sub

Used as modifiers

type FoldDescription mods = FoldDescription' "" mods Source #

Fold modifier list to decide whether argument should be parsed strictly or leniently.

>>> :kind! FoldDescription '[]
FoldDescription '[] :: Symbol
= ""
>>> :kind! FoldDescription '[Required, Description "foobar", Lenient]
FoldDescription '[Required, Description "foobar", Lenient] :: Symbol
= "foobar"

type family FoldDescription' (acc :: Symbol) (mods :: [*]) :: Symbol where ... Source #

Implementation of FoldDescription.

Equations

FoldDescription' acc '[] = acc 
FoldDescription' acc (Description desc ': mods) = FoldDescription' desc mods 
FoldDescription' acc (mod ': mods) = FoldDescription' acc mods 

reflectDescription :: forall mods. KnownSymbol (FoldDescription mods) => Proxy mods -> String Source #

Reflect description to the term level.

>>> reflectDescription (Proxy :: Proxy '[Required, Description "foobar", Lenient])
"foobar"