EllaSource codeContentsIndex
Ella.Param
Description
Type class and utilities used for making it easy to capture parameters from URLs and parse GET/POST values as specific types.
Synopsis
class Param a where
capture :: String -> Maybe a
parseOrDefault :: Read a => Maybe String -> a -> a
captureOrDefault :: Param a => Maybe String -> a -> a
Documentation
class Param a whereSource
Type class representing parameters that can be captured (usually from URL components)
Methods
capture :: String -> Maybe aSource
Convert a string to a value, returning Nothing if not possible
show/hide Instances
Param Bool
Param Int
Param Integer
Param String
parseOrDefault :: Read a => Maybe String -> a -> aSource

Parse a value (packed in a Just) or return a default

This is useful in dealing with Maybe vals returned from getGET, getPOST etc. It can be used with any types that are instances of Read. Note that Read for Strings expects quotes and escaping, so this in general is not useful for String values.

captureOrDefault :: Param a => Maybe String -> a -> aSource

Parse a value (packed in a Just) or return a default

This is useful in dealing with Maybe vals returned from getGET, getPOST etc. It can be used with any types that are instances of Param.

Produced by Haddock version 2.4.2