Standard Library

now : timestamp
The time the current request was made.
emptyHtml : html
Blank HTML.
docType : html
The HTML <!DOCTYPE html> declaration
cookie : text -> maybe text
Retrieve the contents of a browser cookie.
addCookie : response -> text -> text -> response
addCookie response key value adds a cookie to a response.
maybe : maybe 'a -> 'b -> ('a -> 'b) -> 'b
Branch on a maybe type.
bindMaybe : maybe 'a -> ('a -> maybe 'b) -> maybe 'b
Chain maybe values.
listHead : list 'a -> maybe 'a
The first element of a list.
true : bool
false : bool
not : bool -> bool
Boolean logic.

Text

textLength : text -> int
The length of the given text.
regexpMatch : text -> text -> bool
regexpMatch regexp text tests text against regexp.
commonMark : text -> html
Parse text as 'common mark'.

IO Actions

liftIO : 'a -> io 'a
Lift a pure expression into io.
genUUID : io text
Generates a unique UUID v4 string
randomBytes : int -> io text
Generates N random bytes, base64 encoded. This is useful for generating session keys.

Responses

redirect : text -> response
Construct a 302 redirect response to the given path.
file : text -> text -> response
file contentType path constructs a response that serves path with the given contentType.
json : 'a -> jsonResponse 'a
Constructs a JSON response with content type application/json. The type variable 'a must be valid JSON - text, int, bool, or lists or records of JSON.

Passwords

hashPassword : text -> password
Hashes a password.
validatePassword : text -> password -> bool
Check a password against a password hash