Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data ResponderM a = ResponderM (Request -> IO (Either RouteAction (a, Request)))
- data RouteAction
- data ParsedRequest = ParsedRequest {
- preqBody :: Maybe ParsedBody
- preqCookieParams :: [Param]
- preqPathParams :: [Param]
- preqQueryParams :: [Param]
- data ResponderOptions = ResponderOptions {}
- data ParsedBody
- data HttpError = HttpError Status String
- type Param = (Text, Text)
- data PathPattern = MatchPath (Request -> Maybe [Param])
- matchPath :: Text -> Request -> Maybe [Param]
- class ParsableParam a where
- parseParam :: Text -> Either HttpError a
- parseParamList :: Text -> Either HttpError [a]
- readEither :: Read a => Text -> Either HttpError a
Documentation
data ResponderM a Source #
ResponderM
is an Either-like monad that can "short-circuit" and return a
response, or pass control to the next middleware. This provides convenient
branching with do notation for redirects, error responses, etc.
ResponderM (Request -> IO (Either RouteAction (a, Request))) |
Instances
data ParsedRequest Source #
ParsedRequest | |
|
data ResponderOptions Source #
data ParsedBody Source #
Instances
Eq HttpError Source # | |
Show HttpError Source # | |
Exception HttpError Source # | |
Defined in Web.Twain.Types toException :: HttpError -> SomeException # fromException :: SomeException -> Maybe HttpError # displayException :: HttpError -> String # |
data PathPattern Source #
Instances
IsString PathPattern Source # | |
Defined in Web.Twain.Types fromString :: String -> PathPattern # |
class ParsableParam a where Source #
Parse values from request parameters.
parseParam :: Text -> Either HttpError a Source #
parseParamList :: Text -> Either HttpError [a] Source #
Default implementation parses comma-delimited lists.
Instances
readEither :: Read a => Text -> Either HttpError a Source #
Useful for creating ParsableParam
instances for things that already implement Read
.