Safe Haskell | None |
---|
Snap.Predicates.Params
- data Parameter a = Parameter {
- _name :: !ByteString
- _read :: [ByteString] -> Either ByteString a
- _default :: !(Maybe a)
- data Param a = Param ByteString
- data ParamOpt a = ParamOpt ByteString
- data ParamDef a = ParamDef ByteString a
Documentation
The most generic request parameter predicate provided.
It will get all request parameter values of _name
and pass them on to
the conversion function _read
, which might either yield an error
message or a value. In case of error, an optional default may be
returned instead, if nothing is provided, the error message will be used
when construction the 400 status.
Constructors
Parameter | |
Fields
|
Specialisation of Parameter
which returns the first request
which could be converted to the target type.
Constructors
Param ByteString |
Like Param
, but denoting an optional parameter, i.e. if the
parameter is not present or can not be converted to the target type, the
predicate will still succeed.
Constructors
ParamOpt ByteString |
Like Param
, but in case the parameter could not be found, the
provided default value will be used. ParamDef is provided for
convenience and nothing else than Param || Const, e.g.
ParamDef "foo" 0 == Param "foo"
.
:|:
Const
0
Constructors
ParamDef ByteString a |