Safe Haskell | None |
---|---|
Language | Haskell98 |
- type SessionMap = Map Text ByteString
- type SaveSession = SessionMap -> IO [Header]
- newtype SessionBackend = SessionBackend {
- sbLoadSession :: Request -> IO (SessionMap, SaveSession)
- data SessionCookie = SessionCookie (Either UTCTime ByteString) ByteString SessionMap
- data ClientSessionDateCache = ClientSessionDateCache {}
- data YesodRequest = YesodRequest {
- reqGetParams :: ![(Text, Text)]
- reqCookies :: ![(Text, Text)]
- reqWaiRequest :: !Request
- reqLangs :: ![Text]
- reqToken :: !(Maybe Text)
- reqSession :: !SessionMap
- reqAccept :: ![ContentType]
- data YesodResponse
- = YRWai !Response
- | YRWaiApp !Application
- | YRPlain !Status ![Header] !ContentType !Content !SessionMap
- type RequestBodyContents = ([(Text, Text)], [(Text, FileInfo)])
- data FileInfo = FileInfo {
- fileName :: !Text
- fileContentType :: !Text
- fileSourceRaw :: !(Source (ResourceT IO) ByteString)
- fileMove :: !(FilePath -> IO ())
- data FileUpload
- = FileUploadMemory !(BackEnd ByteString)
- | FileUploadDisk !(InternalState -> BackEnd FilePath)
- | FileUploadSource !(BackEnd (Source (ResourceT IO) ByteString))
- data Approot master
- = ApprootRelative
- | ApprootStatic !Text
- | ApprootMaster !(master -> Text)
- | ApprootRequest !(master -> Request -> Text)
- type ResolvedApproot = Text
- data AuthResult
- = Authorized
- | AuthenticationRequired
- | Unauthorized Text
- data ScriptLoadPosition master
- type BottomOfHeadAsync master = [Text] -> Maybe (HtmlUrl (Route master)) -> HtmlUrl (Route master)
- type Texts = [Text]
- newtype WaiSubsite = WaiSubsite {}
- data RunHandlerEnv site = RunHandlerEnv {
- rheRender :: !(Route site -> [(Text, Text)] -> Text)
- rheRoute :: !(Maybe (Route site))
- rheSite :: !site
- rheUpload :: !(RequestBodyLength -> FileUpload)
- rheLog :: !(Loc -> LogSource -> LogLevel -> LogStr -> IO ())
- rheOnError :: !(ErrorResponse -> YesodApp)
- rheGetMaxExpires :: IO Text
- data HandlerData site parentRoute = HandlerData {
- handlerRequest :: !YesodRequest
- handlerEnv :: !(RunHandlerEnv site)
- handlerState :: !(IORef GHState)
- handlerToParent :: !(Route site -> parentRoute)
- handlerResource :: !InternalState
- data YesodRunnerEnv site = YesodRunnerEnv {
- yreLogger :: !Logger
- yreSite :: !site
- yreSessionBackend :: !(Maybe SessionBackend)
- yreGen :: !GenIO
- data YesodSubRunnerEnv sub parent parentMonad = YesodSubRunnerEnv {
- ysreParentRunner :: !(ParentRunner parent parentMonad)
- ysreGetSub :: !(parent -> sub)
- ysreToParentRoute :: !(Route sub -> Route parent)
- ysreParentEnv :: !(YesodRunnerEnv parent)
- type ParentRunner parent m = m TypedContent -> YesodRunnerEnv parent -> Maybe (Route parent) -> Application
- newtype HandlerT site m a = HandlerT {
- unHandlerT :: HandlerData site (MonadRoute m) -> m a
- type family MonadRoute m
- data GHState = GHState {
- ghsSession :: SessionMap
- ghsRBC :: Maybe RequestBodyContents
- ghsIdent :: Int
- ghsCache :: TypeMap
- ghsCacheBy :: KeyedTypeMap
- ghsHeaders :: Endo [Header]
- type YesodApp = YesodRequest -> ResourceT IO YesodResponse
- newtype WidgetT site m a = WidgetT {
- unWidgetT :: HandlerData site (MonadRoute m) -> m (a, GWData (Route site))
- type RY master = Route master -> [(Text, Text)] -> Text
- newtype CssBuilder = CssBuilder {
- unCssBuilder :: Builder
- data PageContent url = PageContent {}
- data Content
- = ContentBuilder !Builder !(Maybe Int)
- | ContentSource !(Source (ResourceT IO) (Flush Builder))
- | ContentFile !FilePath !(Maybe FilePart)
- | ContentDontEvaluate !Content
- data TypedContent = TypedContent !ContentType !Content
- type RepHtml = Html
- newtype RepJson = RepJson Content
- newtype RepPlain = RepPlain Content
- newtype RepXml = RepXml Content
- type ContentType = ByteString
- newtype DontFullyEvaluate a = DontFullyEvaluate {
- unDontFullyEvaluate :: a
- data ErrorResponse
- = NotFound
- | InternalError Text
- | InvalidArgs [Text]
- | NotAuthenticated
- | PermissionDenied Text
- | BadMethod Method
- data Header
- = AddCookie SetCookie
- | DeleteCookie ByteString ByteString
- | Header ByteString ByteString
- data Location url
- newtype UniqueList x = UniqueList ([x] -> [x])
- data Script url = Script {
- scriptLocation :: Location url
- scriptAttributes :: [(Text, Text)]
- data Stylesheet url = Stylesheet {
- styleLocation :: Location url
- styleAttributes :: [(Text, Text)]
- newtype Title = Title {
- unTitle :: Html
- newtype Head url = Head (HtmlUrl url)
- newtype Body url = Body (HtmlUrl url)
- type CssBuilderUrl a = (a -> [(Text, Text)] -> Text) -> Builder
- data GWData a = GWData {
- gwdBody :: !(Body a)
- gwdTitle :: !(Last Title)
- gwdScripts :: !(UniqueList (Script a))
- gwdStylesheets :: !(UniqueList (Stylesheet a))
- gwdCss :: !(Map (Maybe Text) (CssBuilderUrl a))
- gwdJavascript :: !(Maybe (JavascriptUrl a))
- gwdHead :: !(Head a)
- data HandlerContents
- = HCContent Status !TypedContent
- | HCError ErrorResponse
- | HCSendFile ContentType FilePath (Maybe FilePart)
- | HCRedirect Status Text
- | HCCreated Text
- | HCWai Response
- | HCWaiApp Application
- data Logger = Logger {
- loggerSet :: !LoggerSet
- loggerDate :: !DateCacheGetter
- loggerPutStr :: Logger -> LogStr -> IO ()
Documentation
type SessionMap = Map Text ByteString Source
type SaveSession Source
= SessionMap | The session contents after running the handler |
-> IO [Header] |
newtype SessionBackend Source
SessionBackend | |
|
data SessionCookie Source
Read SessionCookie | |
Show SessionCookie | |
Serialize SessionCookie |
data YesodRequest Source
The parsed request information. This type augments the standard WAI
Request
with additional information.
YesodRequest | |
|
data YesodResponse Source
An augmented WAI Response
. This can either be a standard Response
,
or a higher-level data structure which Yesod will turn into a Response
.
YRWai !Response | |
YRWaiApp !Application | |
YRPlain !Status ![Header] !ContentType !Content !SessionMap |
type RequestBodyContents = ([(Text, Text)], [(Text, FileInfo)]) Source
A tuple containing both the POST parameters and submitted files.
FileInfo | |
|
data FileUpload Source
FileUploadMemory !(BackEnd ByteString) | |
FileUploadDisk !(InternalState -> BackEnd FilePath) | |
FileUploadSource !(BackEnd (Source (ResourceT IO) ByteString)) |
How to determine the root of the application for constructing URLs.
Note that future versions of Yesod may add new constructors without bumping
the major version number. As a result, you should not pattern match on
Approot
values.
ApprootRelative | No application root. |
ApprootStatic !Text | |
ApprootMaster !(master -> Text) | |
ApprootRequest !(master -> Request -> Text) |
type ResolvedApproot = Text Source
data AuthResult Source
data ScriptLoadPosition master Source
type BottomOfHeadAsync master Source
newtype WaiSubsite Source
Wrap up a normal WAI application as a Yesod subsite.
ParseRoute WaiSubsite | |
RenderRoute WaiSubsite | |
YesodSubDispatch WaiSubsite master | |
Eq (Route WaiSubsite) | |
Ord (Route WaiSubsite) | |
Read (Route WaiSubsite) | |
Show (Route WaiSubsite) | |
data Route WaiSubsite = WaiSubsiteRoute [Text] [(Text, Text)] |
data RunHandlerEnv site Source
RunHandlerEnv | |
|
data HandlerData site parentRoute Source
HandlerData | |
|
data YesodRunnerEnv site Source
YesodRunnerEnv | |
|
data YesodSubRunnerEnv sub parent parentMonad Source
YesodSubRunnerEnv | |
|
type ParentRunner parent m = m TypedContent -> YesodRunnerEnv parent -> Maybe (Route parent) -> Application Source
newtype HandlerT site m a Source
A generic handler monad, which can have a different subsite and master site. We define a newtype for better error message.
HandlerT | |
|
MonadBase b m => MonadBase b (HandlerT site m) | |
Monad m => MonadReader site (HandlerT site m) | |
MonadBaseControl b m => MonadBaseControl b (HandlerT site m) | Note: although we provide a Using fork usually leads to an exception that says "Control.Monad.Trans.Resource.register': The mutable state is being accessed after cleanup. Please contact the maintainers." |
MonadTrans (HandlerT site) | |
Monad m => Monad (HandlerT site m) | |
Monad m => Functor (HandlerT site m) | |
Monad m => Applicative (HandlerT site m) | |
MonadIO m => MonadIO (HandlerT site m) | |
MonadThrow m => MonadThrow (HandlerT site m) | |
MonadMask m => MonadMask (HandlerT site m) | |
MonadCatch m => MonadCatch (HandlerT site m) | |
(MonadIO m, MonadBase IO m, MonadThrow m) => MonadResource (HandlerT site m) | |
MonadActive m => MonadActive (HandlerT site m) | |
MonadIO m => MonadLoggerIO (HandlerT site m) | |
MonadIO m => MonadLogger (HandlerT site m) | |
MonadResourceBase m => MonadHandler (HandlerT site m) | |
data StM (HandlerT site m) = StH (StM m a) | |
type MonadRoute (HandlerT site m) = Route site | |
type HandlerSite (HandlerT site m) = site |
type family MonadRoute m Source
type MonadRoute IO = () | |
type MonadRoute (HandlerT site m) = Route site |
GHState | |
|
type YesodApp = YesodRequest -> ResourceT IO YesodResponse Source
An extension of the basic WAI Application
datatype to provide extra
features needed by Yesod. Users should never need to use this directly, as
the HandlerT
monad and template haskell code should hide it away.
newtype WidgetT site m a Source
A generic widget, allowing specification of both the subsite and master
site datatypes. While this is simply a WriterT
, we define a newtype for
better error messages.
WidgetT | |
|
MonadBase b m => MonadBase b (WidgetT site m) | |
Monad m => MonadReader site (WidgetT site m) | |
MonadBaseControl b m => MonadBaseControl b (WidgetT site m) | |
((~) * site' site, (~) (* -> *) IO m, (~) * a ()) => ToWidget site' (WidgetT site m a) | |
MonadTrans (WidgetT site) | |
Monad m => Monad (WidgetT site m) | |
Monad m => Functor (WidgetT site m) | |
Monad m => Applicative (WidgetT site m) | |
MonadIO m => MonadIO (WidgetT site m) | |
MonadThrow m => MonadThrow (WidgetT site m) | |
MonadMask m => MonadMask (WidgetT site m) | |
MonadCatch m => MonadCatch (WidgetT site m) | |
(Applicative m, MonadIO m, MonadBase IO m, MonadThrow m) => MonadResource (WidgetT site m) | |
MonadActive m => MonadActive (WidgetT site m) | |
MonadIO m => MonadLoggerIO (WidgetT site m) | |
MonadIO m => MonadLogger (WidgetT site m) | |
MonadResourceBase m => MonadWidget (WidgetT site m) | |
MonadResourceBase m => MonadHandler (WidgetT site m) | |
((~) * a (), Monad m) => Monoid (WidgetT site m a) | |
data StM (WidgetT site m) = StW (StM m (a, GWData (Route site))) | |
type HandlerSite (WidgetT site m) = site |
newtype CssBuilder Source
Newtype wrapper allowing injection of arbitrary content into CSS.
Usage:
toWidget $ CssBuilder "p { color: red }"
Since: 1.1.3
CssBuilder | |
|
ToWidgetHead site CssBuilder | |
ToWidgetMedia site CssBuilder | |
ToWidget site CssBuilder | |
(~) * render (RY site) => ToWidgetHead site (render -> CssBuilder) | |
(~) * render (RY site) => ToWidgetMedia site (render -> CssBuilder) | |
(~) * render (RY site) => ToWidget site (render -> CssBuilder) |
data PageContent url Source
Content for a web page. By providing this datatype, we can easily create generic site templates, which would have the type signature:
PageContent url -> HtmlUrl url
ContentBuilder !Builder !(Maybe Int) | The content and optional content length. |
ContentSource !(Source (ResourceT IO) (Flush Builder)) | |
ContentFile !FilePath !(Maybe FilePart) | |
ContentDontEvaluate !Content |
data TypedContent Source
type ContentType = ByteString Source
newtype DontFullyEvaluate a Source
Prevents a response body from being fully evaluated before sending the request.
Since 1.1.0
ToTypedContent a => ToTypedContent (DontFullyEvaluate a) | |
HasContentType a => HasContentType (DontFullyEvaluate a) | |
ToContent a => ToContent (DontFullyEvaluate a) |
data ErrorResponse Source
Responses to indicate some form of an error occurred. These are different
from SpecialResponse
in that they allow for custom error pages.
NotFound | |
InternalError Text | |
InvalidArgs [Text] | |
NotAuthenticated | |
PermissionDenied Text | |
BadMethod Method |
Headers to be added to a Result
.
newtype UniqueList x Source
A diff list that does not directly enforce uniqueness. When creating a widget Yesod will use nub to make it unique.
UniqueList ([x] -> [x]) |
Monoid (UniqueList x) |
Script | |
|
data Stylesheet url Source
Stylesheet | |
|
Eq url => Eq (Stylesheet url) | |
Show url => Show (Stylesheet url) |
type CssBuilderUrl a = (a -> [(Text, Text)] -> Text) -> Builder Source
GWData | |
|
data HandlerContents Source
HCContent Status !TypedContent | |
HCError ErrorResponse | |
HCSendFile ContentType FilePath (Maybe FilePart) | |
HCRedirect Status Text | |
HCCreated Text | |
HCWai Response | |
HCWaiApp Application |
Logger | |
|
loggerPutStr :: Logger -> LogStr -> IO () Source