coltrane-0.1.0.0: A jazzy, minimal web framework for Haskell, inspired by Sinatra.

Safe HaskellNone

ColtraneTypes

Synopsis

Documentation

data Route Source

a Route is composed of:

  • a method (uses the StdMethod type from Network.HTTP.Types.Method)
  • a path (defined below)
  • a handler (defined below)

Constructors

Route 

data ResponseState Source

A ResponseState holds a body, headers, and a status. When used with MonadState, this type makes it easy to add headers and change the response status; WAI does not provide simple mechanisms for modifying the headers and status.

Constructors

RS 

data HandlerState Source

The HandlerState contains the parameters, the request object, and the response state.

Constructors

HS 

Fields

resp :: ResponseState
 
pms :: Params
 
req :: Request
 

data Server Source

Server options for running the application.

Constructors

Warp 
CGI 

Instances

type ContentType = ByteStringSource

Stores the content-type constants for the response headers.

type ResponseBody = StringSource

A ResponseBody is a string.

data Path Source

A path is either a String Literal or a Regular Expression.

Constructors

Literal String 
RegExp Regex 

type Params = [(ParamKey, ParamValue)]Source

Key value pairs of URL parameters.

convertBSParams :: [Param] -> ParamsSource

Converts [Parse.Param] to Params.

type Handler = HandlerM ()Source

A type alias to make routes intuitive for the user.

newtype ColtraneApp a Source

A monad that holds the application's registered routes.

Constructors

C 

Fields

runCA :: StateT [Route] IO a
 

newtype HandlerM a Source

Stores the current parameters, Request, and the ResponseState that gets 'built up' in a Handler; the response body, headers, and status may be altered. The HandlerM also has error handling capabilities. The Handler is the third component of a Route; a Method and a Path are associated with a Handler.

Constructors

HM