growler-0.6.0: A revised version of the scotty library that attempts to be simpler and more performant.

Safe HaskellSafe-Inferred
LanguageHaskell2010

Web.Growler.Parsable

Synopsis

Documentation

class Parsable a where Source

Minimum implemention: parseParam

Minimal complete definition

parseParam

Methods

parseParam :: ByteString -> Either ByteString a Source

Take a ByteString value and parse it as a, or fail with a message.

parseParamList :: ByteString -> Either ByteString [a] Source

Default implementation parses comma-delimited lists.

parseParamList t = mapM parseParam (BS.split ',' t)

Instances

Parsable Bool 
Parsable Char

Overrides default parseParamList to parse String.

Parsable Double 
Parsable Float 
Parsable Int 
Parsable Integer 
Parsable ()

Checks if parameter is present and is null-valued, not a literal '()'. If the URI requested is: '/foo?bar=()&baz' then baz will parse as (), where bar will not.

Parsable ByteString 
Parsable Text 
Parsable Text 
Parsable a => Parsable [a] 

readEither :: Read a => ByteString -> Either ByteString a Source

Useful for creating Parsable instances for things that already implement Read. Ex:

instance Parsable Int where parseParam = readEither