Module

Type.Trout

Package
purescript-trout
Repository
owickstrom/purescript-trout

#Lit Source

data Lit (v :: Symbol)

A literal path segment, matching paths where the next segment is equal to the value of the Symbol.

For example, the type Lit "settings" :> Lit "general" :> "reset" would match the path /settings/general/reset.

#Capture Source

data Capture (v :: Symbol) t

Captures one segment of a path as type t. The v is a Symbol that describes the captured value.

#CaptureAll Source

data CaptureAll (v :: Symbol) t

Captures all remaining segments of a path, all as type t. The v is a Symbol that describes the captured value.

#Resource Source

data Resource ms

A type-level description of an HTTP resource, terminating a chain of path literals, captures, and other endpoint type constructs. The ms are the methods handled by this resource.

#Method Source

data Method (m :: Symbol) r cts

The m symbol is the HTTP method that is handled, r is the response representation (usually some type specific to the application domain,) and cts are the content types supported.

#Raw Source

data Raw (m :: Symbol)

A type-level description of a raw middleware, terminating a chain of path literals, captures, and other endpoint type constructs. The m symbol is the HTTP method that is handled.

#Sub Source

data Sub e t

The Sub is used to create the chain of Lit, Capture, Resource, and other such type constructs that build up an endpoint type. Sub is more often used infix with the :> operator.

#LitSub Source

type LitSub (v :: Symbol) t = Sub (Lit v) t

A handy type alias for Sub (Lit v), meant to be used infix with the :/ operator. Instead of writing Lit "a" :> Lit "b" :> ..., you can write "a" :/ "b" :/ ....

#Alt Source

data Alt a b

Alt represents choice, i.e. that endpoint a is tried first, and if it fails, b is tried next. Alt is written infix using :<|> and is used to compose multiple endpoint types into a larger API or site. Using the infix operator, Alt a (Alt b c) can be written a :<|> b :<|> c.

#Named Source

data Named (name :: Symbol) t

Named associates some routing type t with a name symbol. This is used to give names to combined routes in a routing type.

#QueryParam Source

data QueryParam (k :: Symbol) t

Captures the first value of the query string parameter, or Nothing. t is the type of the value. k is the name of the key as a Symbol.

#QueryParams Source

data QueryParams (k :: Symbol) t

Captures all values of the query string parameter, or []. t is the type of the value. k is the name of the key as a Symbol.

#Header Source

data Header (n :: Symbol) t

Captures the value of a request header. t is the type of the value. n is the name of the header as a Symbol.

#ReqBody Source

data ReqBody r cts

Captures the request body. The r parameter is the type represented by the request body (usually some type specific to the application domain), and cts represents the content types supported.

#type (:>) Source

Operator alias for Type.Trout.Sub (right-associative / precedence 9)

#type (:/) Source

Operator alias for Type.Trout.LitSub (right-associative / precedence 9)

#type (:<|>) Source

Operator alias for Type.Trout.Alt (right-associative / precedence 7)

#type (:=) Source

Operator alias for Type.Trout.Named (right-associative / precedence 8)