yesod-core
Safe HaskellNone
LanguageHaskell2010

Yesod.Core

Synopsis

Type classes

class RenderRoute site => Yesod site where Source #

Define settings for a Yesod applications. All methods have intelligent defaults, and therefore no implementation is required.

Minimal complete definition

Nothing

Methods

approot :: Approot site Source #

An absolute URL to the root of the application. Do not include trailing slash.

Default value: guessApproot. If you know your application root statically, it will be more efficient and more reliable to instead use ApprootStatic or ApprootMaster. If you do not need full absolute URLs, you can use ApprootRelative instead.

Note: Prior to yesod-core 1.5, the default value was ApprootRelative.

catchHandlerExceptions :: MonadUnliftIO m => site -> m a -> (SomeException -> m a) -> m a Source #

allows the user to specify how exceptions are cought. by default all async exceptions are thrown and synchronous exceptions render a 500 page. To catch all exceptions (even async) to render a 500 page, set this to catchSyncOrAsync. Beware this may have negative effects with functions like timeout.

Since: 1.6.24.0

errorHandler :: ErrorResponse -> HandlerFor site TypedContent Source #

Output error response pages.

Default value: defaultErrorHandler.

defaultLayout :: WidgetFor site () -> HandlerFor site Html Source #

Applies some form of layout to the contents of a page.

urlParamRenderOverride Source #

Arguments

:: site 
-> Route site 
-> [(Text, Text)]

query string

-> Maybe Builder 

Override the rendering function for a particular URL and query string parameters. One use case for this is to offload static hosting to a different domain name to avoid sending cookies.

For backward compatibility default implementation is in terms of urlRenderOverride, probably ineffective

Since 1.4.23

isAuthorized Source #

Arguments

:: Route site 
-> Bool

is this a write request?

-> HandlerFor site AuthResult 

Determine if a request is authorized or not.

Return Authorized if the request is authorized, Unauthorized a message if unauthorized. If authentication is required, return AuthenticationRequired.

isWriteRequest :: Route site -> HandlerFor site Bool Source #

Determines whether the current request is a write request. By default, this assumes you are following RESTful principles, and determines this from request method. In particular, all except the following request methods are considered write: GET HEAD OPTIONS TRACE.

This function is used to determine if a request is authorized; see isAuthorized.

authRoute :: site -> Maybe (Route site) Source #

The default route for authentication.

Used in particular by isAuthorized, but library users can do whatever they want with it.

cleanPath :: site -> [Text] -> Either [Text] [Text] Source #

A function used to clean up path segments. It returns Right with a clean path or Left with a new set of pieces the user should be redirected to. The default implementation enforces:

  • No double slashes
  • There is no trailing slash.

Note that versions of Yesod prior to 0.7 used a different set of rules involing trailing slashes.

joinPath Source #

Arguments

:: site 
-> Text

application root

-> [Text]

path pieces

-> [(Text, Text)]

query string

-> Builder 

Builds an absolute URL by concatenating the application root with the pieces of a path and a query string, if any. Note that the pieces of the path have been previously cleaned up by cleanPath.

addStaticContent Source #

Arguments

:: Text

filename extension

-> Text

mime-type

-> ByteString

content

-> HandlerFor site (Maybe (Either Text (Route site, [(Text, Text)]))) 

This function is used to store some static content to be served as an external file. The most common case of this is stashing CSS and JavaScript content in an external file; the Yesod.Widget module uses this feature.

The return value is Nothing if no storing was performed; this is the default implementation. A Just Left gives the absolute URL of the file, whereas a Just Right gives the type-safe URL. The former is necessary when you are serving the content outside the context of a Yesod application, such as via memcached.

maximumContentLength :: site -> Maybe (Route site) -> Maybe Word64 Source #

Maximum allowed length of the request body, in bytes. This method may be ignored if maximumContentLengthIO is overridden.

If Nothing, no maximum is applied.

Default: 2 megabytes.

maximumContentLengthIO :: site -> Maybe (Route site) -> IO (Maybe Word64) Source #

Maximum allowed length of the request body, in bytes. This is similar to maximumContentLength, but the result lives in IO. This allows you to dynamically change the maximum file size based on some external source like a database or an IORef.

The default implementation uses maximumContentLength. Future version of yesod will remove maximumContentLength and use this method exclusively.

Since: 1.6.13

makeLogger :: site -> IO Logger Source #

Creates a Logger to use for log messages.

Note that a common technique (endorsed by the scaffolding) is to create a Logger value and place it in your foundation datatype, and have this method return that already created value. That way, you can use that same Logger for printing messages during app initialization.

Default: the defaultMakeLogger function.

messageLoggerSource Source #

Arguments

:: site 
-> Logger 
-> Loc

position in source code

-> LogSource 
-> LogLevel 
-> LogStr

message

-> IO () 

Send a message to the Logger provided by getLogger.

Default: the defaultMessageLoggerSource function, using shouldLogIO to check whether we should log.

jsLoader :: site -> ScriptLoadPosition site Source #

Where to Load sripts from. We recommend the default value, BottomOfBody.

jsAttributes :: site -> [(Text, Text)] Source #

Default attributes to put on the JavaScript script tag generated for julius files

jsAttributesHandler :: HandlerFor site [(Text, Text)] Source #

Same as jsAttributes but allows you to run arbitrary Handler code

This is useful if you need to add a randomised nonce value to the script tag generated by widgetFile. If this function is overridden then jsAttributes is ignored.

Since: 1.6.16

makeSessionBackend :: site -> IO (Maybe SessionBackend) Source #

Create a session backend. Returning Nothing disables sessions. If you'd like to change the way that the session cookies are created, take a look at customizeSessionCookies.

Default: Uses clientsession with a 2 hour timeout.

fileUpload :: site -> RequestBodyLength -> FileUpload Source #

How to store uploaded files.

Default: When the request body is greater than 50kb, store in a temp file. For chunked request bodies, store in a temp file. Otherwise, store in memory.

shouldLogIO :: site -> LogSource -> LogLevel -> IO Bool Source #

Should we log the given log source/level combination.

Default: the defaultShouldLogIO function.

Since 1.2.4

yesodMiddleware :: ToTypedContent res => HandlerFor site res -> HandlerFor site res Source #

A Yesod middleware, which will wrap every handler function. This allows you to run code before and after a normal handler.

Default: the defaultYesodMiddleware function.

Since: 1.1.6

yesodWithInternalState :: site -> Maybe (Route site) -> (InternalState -> IO a) -> IO a Source #

How to allocate an InternalState for each request.

The default implementation is almost always what you want. However, if you know that you are never taking advantage of the MonadResource instance in your handler functions, setting this to a dummy implementation can provide a small optimization. Only do this if you really know what you're doing, otherwise you can turn safe code into a runtime error!

Since 1.4.2

defaultMessageWidget :: Html -> HtmlUrl (Route site) -> WidgetFor site () Source #

Convert a title and HTML snippet into a Widget. Used primarily for wrapping up error messages for better display.

Since: 1.4.30

Instances

Instances details
Yesod LiteApp Source # 
Instance details

Defined in Yesod.Core.Internal.LiteApp

Methods

approot :: Approot LiteApp Source #

catchHandlerExceptions :: MonadUnliftIO m => LiteApp -> m a -> (SomeException -> m a) -> m a Source #

errorHandler :: ErrorResponse -> HandlerFor LiteApp TypedContent Source #

defaultLayout :: WidgetFor LiteApp () -> HandlerFor LiteApp Html Source #

urlParamRenderOverride :: LiteApp -> Route LiteApp -> [(Text, Text)] -> Maybe Builder Source #

isAuthorized :: Route LiteApp -> Bool -> HandlerFor LiteApp AuthResult Source #

isWriteRequest :: Route LiteApp -> HandlerFor LiteApp Bool Source #

authRoute :: LiteApp -> Maybe (Route LiteApp) Source #

cleanPath :: LiteApp -> [Text] -> Either [Text] [Text] Source #

joinPath :: LiteApp -> Text -> [Text] -> [(Text, Text)] -> Builder Source #

addStaticContent :: Text -> Text -> ByteString -> HandlerFor LiteApp (Maybe (Either Text (Route LiteApp, [(Text, Text)]))) Source #

maximumContentLength :: LiteApp -> Maybe (Route LiteApp) -> Maybe Word64 Source #

maximumContentLengthIO :: LiteApp -> Maybe (Route LiteApp) -> IO (Maybe Word64) Source #

makeLogger :: LiteApp -> IO Logger Source #

messageLoggerSource :: LiteApp -> Logger -> Loc -> LogSource -> LogLevel -> LogStr -> IO () Source #

jsLoader :: LiteApp -> ScriptLoadPosition LiteApp Source #

jsAttributes :: LiteApp -> [(Text, Text)] Source #

jsAttributesHandler :: HandlerFor LiteApp [(Text, Text)] Source #

makeSessionBackend :: LiteApp -> IO (Maybe SessionBackend) Source #

fileUpload :: LiteApp -> RequestBodyLength -> FileUpload Source #

shouldLogIO :: LiteApp -> LogSource -> LogLevel -> IO Bool Source #

yesodMiddleware :: ToTypedContent res => HandlerFor LiteApp res -> HandlerFor LiteApp res Source #

yesodWithInternalState :: LiteApp -> Maybe (Route LiteApp) -> (InternalState -> IO a) -> IO a Source #

defaultMessageWidget :: Html -> HtmlUrl (Route LiteApp) -> WidgetFor LiteApp () Source #

class Yesod site => YesodDispatch site where Source #

This class is automatically instantiated when you use the template haskell mkYesod function. You should never need to deal with it directly.

Instances

Instances details
YesodDispatch LiteApp Source # 
Instance details

Defined in Yesod.Core.Internal.LiteApp

class RenderRouteNested a => YesodDispatchNested a where Source #

This class enables you to dispatch on a route fragment without needing to know how to dispatch on the entire route structure. This allows you to break up route generation into multiple files.

For details on use, see setFocusOnNestedRoute.

Since: 1.7.0.0

Methods

yesodDispatchNested Source #

Arguments

:: Proxy a

Type proxy to resolve ambiguity from non-injective type families

-> ParentArgs a

The dynamic arguments from the parent route

-> (a -> Route (ParentSite a))

Function to wrap the nested route in the parent constructor

-> YesodRunnerEnv (ParentSite a)

The runner environment

-> Request

The full WAI request

-> Maybe ((Response -> IO ResponseReceived) -> IO ResponseReceived)

Returns Nothing for fallthrough, or Just a continuation that completes the Application type when given a respond callback

Dispatches a request to a nested route fragment.

The implementation uses the full WAI Request to determine if the remaining path (after the parent route) matches any child routes. Returns Nothing if no child routes match (for fallthrough to other routes), or Just a continuation that handles the request.

The parent depth (number of path pieces consumed by the parent route) is statically known during Template Haskell generation and baked into the generated instance.

Since: 1.7.0.0

Instances

Instances details
YesodDispatch site => YesodDispatchNested (Route site) Source #

YesodDispatchNested is a more flexible class than YesodDispatch, and this instance is the proof. Given a Route site we can dispatch on it as normal, so this code path works. This allows us to create generalized helpers and reuse them, ensuring that nested and top-level dispatch remain equivalent. This instance therefore always returns Just — committing to yesodDispatch, which itself terminates in a 404 on a miss — rather than the Nothing that the class haddock describes for fragment instances. The only intended caller is the terminal authority toWaiAppYreNested, where that 404 is exactly the right answer; do not rely on this instance to signal fallthrough.

Instance details

Defined in Yesod.Core.Class.Dispatch

Methods

yesodDispatchNested :: Proxy (Route site) -> ParentArgs (Route site) -> (Route site -> Route (ParentSite (Route site))) -> YesodRunnerEnv (ParentSite (Route site)) -> Request -> Maybe ((Response -> IO ResponseReceived) -> IO ResponseReceived) Source #

class RenderRouteNested a => YesodSubDispatchNested a where Source #

Like YesodDispatchNested, but for subsites. This class enables class-based delegation for nested routes within subsites, allowing module separation and symmetry with YesodDispatchNested.

When a YesodSubDispatchNested instance exists for a nested route type, mkYesodSubDispatch will delegate to it instead of inlining the dispatch. Use mkYesodSubDispatchInstance to generate both YesodSubDispatch and YesodSubDispatchNested instances in one splice.

Since: 1.7.0.0

Methods

yesodSubDispatchNested Source #

Arguments

:: Proxy a

Type proxy to resolve ambiguity from non-injective type families

-> ParentArgs a

The dynamic arguments from the parent route

-> (a -> Route (ParentSite a))

Function to wrap the nested route in the parent constructor

-> YesodSubRunnerEnv (ParentSite a) master

The subsite runner environment

-> Request

The full WAI request

-> Maybe ((Response -> IO ResponseReceived) -> IO ResponseReceived)

Returns Nothing for fallthrough, or Just a continuation

Dispatches a request for a nested route fragment within a subsite.

Similar to yesodDispatchNested, but works with YesodSubRunnerEnv instead of YesodRunnerEnv, making it suitable for subsites. The master type is universally quantified since it's not determined by the nested route type.

Since: 1.7.0.0

class Eq (Route a) => RenderRoute a where Source #

Associated Types

data Route a Source #

The type-safe URLs associated with a site argument.

Methods

renderRoute Source #

Arguments

:: Route a 
-> ([Text], [(Text, Text)])

The path of the URL split on forward slashes, and a list of query parameters with their associated value.

Instances

Instances details
RenderRoute LiteApp Source # 
Instance details

Defined in Yesod.Core.Internal.LiteApp

Associated Types

data Route LiteApp 
Instance details

Defined in Yesod.Core.Internal.LiteApp

data Route LiteApp = LiteAppRoute [Text]

Methods

renderRoute :: Route LiteApp -> ([Text], [(Text, Text)]) Source #

RenderRoute WaiSubsite Source # 
Instance details

Defined in Yesod.Core.Types

Associated Types

data Route WaiSubsite 
Instance details

Defined in Yesod.Core.Types

data Route WaiSubsite = WaiSubsiteRoute [Text] [(Text, Text)]

Methods

renderRoute :: Route WaiSubsite -> ([Text], [(Text, Text)]) Source #

RenderRoute WaiSubsiteWithAuth Source # 
Instance details

Defined in Yesod.Core.Types

Associated Types

data Route WaiSubsiteWithAuth 
Instance details

Defined in Yesod.Core.Types

data Route WaiSubsiteWithAuth = WaiSubsiteWithAuthRoute [Text] [(Text, Text)]

Methods

renderRoute :: Route WaiSubsiteWithAuth -> ([Text], [(Text, Text)]) Source #

Note: the toParentRoute method is intentionally not re-exported here. It collides with a common local binding name (e.g. the toParentRoute from getRouteToParent), so an import Yesod should not inject it. Import it from Yesod.Core.Class.Dispatch.ToParentRoute when you need it.

class RenderRoute (ParentSite a) => ToParentRoute a Source #

Reconstruct a full parent route from a nested route fragment and its ParentArgs (the dynamic pieces consumed by the ancestor parents). This is what lets a fragment dispatched in its own module be rendered back into the master site's Route (ParentSite a).

Since: 1.7.0.0

Minimal complete definition

toParentRoute

Instances

Instances details
RenderRoute a => ToParentRoute (Route a) Source # 
Instance details

Defined in Yesod.Core.Class.Dispatch.ToParentRoute

class Eq a => RenderRouteNested a where Source #

This class acts as a delegation class for RenderRoute on nested route fragments.

Since: 1.7.0.0

Associated Types

type ParentSite a Source #

The site type for a given route fragment.

Since: 1.7.0.0

type ParentArgs a Source #

The ParentArgs are the route fragments necessary to call the dispatched route that are not part of the route fragments used in parsing the route.

Since: 1.7.0.0

type ParentArgs a = ()

Methods

renderRouteNested :: ParentArgs a -> a -> ([Text], [(Text, Text)]) Source #

Render the fragment of the route. To form a complete route, you'll need to mappend this with the result from the parent renderRoute or renderRouteNested call.

Since: 1.7.0.0

Instances

Instances details
RenderRoute site => RenderRouteNested (Route site) Source # 
Instance details

Defined in Yesod.Routes.Class

Associated Types

type ParentSite (Route site) 
Instance details

Defined in Yesod.Routes.Class

type ParentSite (Route site) = site
type ParentArgs (Route site) 
Instance details

Defined in Yesod.Routes.Class

type ParentArgs (Route site) = ()

Methods

renderRouteNested :: ParentArgs (Route site) -> Route site -> ([Text], [(Text, Text)]) Source #

(Eq (ParentArgs a), RenderRouteNested a) => RenderRouteNested (WithParentArgs a) Source # 
Instance details

Defined in Yesod.Routes.Class

Associated Types

type ParentSite (WithParentArgs a) 
Instance details

Defined in Yesod.Routes.Class

type ParentArgs (WithParentArgs a) 
Instance details

Defined in Yesod.Routes.Class

Methods

renderRouteNested :: ParentArgs (WithParentArgs a) -> WithParentArgs a -> ([Text], [(Text, Text)]) Source #

class RenderRoute a => ParseRoute a where Source #

Methods

parseRoute Source #

Arguments

:: ([Text], [(Text, Text)])

The path of the URL split on forward slashes, and a list of query parameters with their associated value.

-> Maybe (Route a) 

Instances

Instances details
ParseRoute LiteApp Source # 
Instance details

Defined in Yesod.Core.Internal.LiteApp

Methods

parseRoute :: ([Text], [(Text, Text)]) -> Maybe (Route LiteApp) Source #

ParseRoute WaiSubsite Source # 
Instance details

Defined in Yesod.Core.Types

Methods

parseRoute :: ([Text], [(Text, Text)]) -> Maybe (Route WaiSubsite) Source #

ParseRoute WaiSubsiteWithAuth Source # 
Instance details

Defined in Yesod.Core.Types

Methods

parseRoute :: ([Text], [(Text, Text)]) -> Maybe (Route WaiSubsiteWithAuth) Source #

class RenderRoute a => RouteAttrs a where Source #

Methods

routeAttrs Source #

Arguments

:: Route a 
-> Set Text

A set of attributes associated with the route.

Since: 1.7.0.0

class RenderRouteNested a => ParseRouteNested a where Source #

Like RenderRouteNested, this acts as a delegation class for nested route fragments.

Note that parseRouteNested and renderRouteNested are not inverses, by design. renderRouteNested consumes the ParentArgs a (the parent's dynamic pieces) to produce a complete path, whereas parseRouteNested recovers only the fragment a and never the ParentArgs — the parent is responsible for those. So parseRouteNested p followed by renderRouteNested args round-trips the fragment portion of p only, with args supplied separately by the caller.

Since: 1.7.0.0

Methods

parseRouteNested Source #

Arguments

:: ([Text], [(Text, Text)])

The path of the URL split on forward slashes, and a list of query parameters with their associated value.

Unlike for parseRoute, this will not include URL fragments as part of parent routes. It is expected that parents will take the resulting a and construct the parent from that.

-> Maybe a 

Parse a route fragment from a path. Like parseRoute, but produces the fragment a directly rather than a complete Route; the parent is responsible for constructing the full route from the result.

Since: 1.7.0.0

Since: 1.7.0.0

class RenderRouteNested a => RouteAttrsNested a where Source #

Like RenderRouteNested, this acts as a delegation class for nested route fragments to provide RouteAttrs.

Since: 1.7.0.0

Methods

routeAttrsNested :: a -> Set Text Source #

Retrieve the RouteAttrs for a given route fragment.

Since: 1.7.0.0

Breadcrumbs

class YesodBreadcrumbs site where Source #

A type-safe, concise method of creating breadcrumbs for pages. For each resource, you declare the title of the page and the parent resource (if present).

Methods

breadcrumb :: Route site -> HandlerFor site (Text, Maybe (Route site)) Source #

Returns the title and the parent resource, if available. If you return a Nothing, then this is considered a top-level page.

breadcrumbs :: (YesodBreadcrumbs site, Show (Route site), Eq (Route site)) => HandlerFor site (Text, [(Route site, Text)]) Source #

Gets the title of the current page and the hierarchy of parent pages, along with their respective titles.

Types

data Approot master Source #

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.

Constructors

ApprootRelative

No application root.

ApprootStatic !Text 
ApprootMaster !(master -> Text) 
ApprootRequest !(master -> Request -> Text) 

data FileUpload Source #

Constructors

FileUploadMemory !(BackEnd ByteString) 
FileUploadDisk !(InternalState -> BackEnd FilePath) 
FileUploadSource !(BackEnd (ConduitT () ByteString (ResourceT IO) ())) 

data ErrorResponse Source #

Responses to indicate some form of an error occurred.

Constructors

NotFound

The requested resource was not found. Examples of when this occurs include when an incorrect URL is used, or yesod-persistent's get404 doesn't find a value. HTTP status: 404.

InternalError !Text

Some sort of unexpected exception. If your application uses throwIO or error to throw an exception, this is the form it would take. HTTP status: 500.

InvalidArgs ![Text]

Indicates some sort of invalid or missing argument, like a missing query parameter or malformed JSON body. Examples Yesod functions that send this include requireCheckJsonBody and Yesod.Auth.GoogleEmail2. HTTP status: 400.

NotAuthenticated

Indicates the user is not logged in. This is thrown when isAuthorized returns AuthenticationRequired. HTTP code: 401.

PermissionDenied !Text

Indicates the user doesn't have permission to access the requested resource. This is thrown when isAuthorized returns Unauthorized. HTTP code: 403.

BadMethod !Method

Indicates the URL would have been valid if used with a different HTTP method (e.g. a GET was used, but only POST is handled.) HTTP code: 405.

Instances

Instances details
NFData ErrorResponse Source # 
Instance details

Defined in Yesod.Core.Types.ErrorResponse

Methods

rnf :: ErrorResponse -> ()

Eq ErrorResponse Source # 
Instance details

Defined in Yesod.Core.Types.ErrorResponse

Generic ErrorResponse Source # 
Instance details

Defined in Yesod.Core.Types.ErrorResponse

Associated Types

type Rep ErrorResponse 
Instance details

Defined in Yesod.Core.Types.ErrorResponse

type Rep ErrorResponse = D1 ('MetaData "ErrorResponse" "Yesod.Core.Types.ErrorResponse" "yesod-core-1.7.0.0-2Vl1V5V1UxYK94UOHLtzzM" 'False) ((C1 ('MetaCons "NotFound" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "InternalError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text)) :+: C1 ('MetaCons "InvalidArgs" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [Text])))) :+: (C1 ('MetaCons "NotAuthenticated" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "PermissionDenied" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text)) :+: C1 ('MetaCons "BadMethod" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Method)))))
Show ErrorResponse Source # 
Instance details

Defined in Yesod.Core.Types.ErrorResponse

Methods

showsPrec :: Int -> ErrorResponse -> ShowS

show :: ErrorResponse -> String

showList :: [ErrorResponse] -> ShowS

type Rep ErrorResponse Source # 
Instance details

Defined in Yesod.Core.Types.ErrorResponse

type Rep ErrorResponse = D1 ('MetaData "ErrorResponse" "Yesod.Core.Types.ErrorResponse" "yesod-core-1.7.0.0-2Vl1V5V1UxYK94UOHLtzzM" 'False) ((C1 ('MetaCons "NotFound" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "InternalError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text)) :+: C1 ('MetaCons "InvalidArgs" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [Text])))) :+: (C1 ('MetaCons "NotAuthenticated" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "PermissionDenied" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text)) :+: C1 ('MetaCons "BadMethod" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Method)))))

The field accessors theParentArgs/parentArgsFor are not re-exported (generic names that would shadow common local bindings); only the type and its constructor are.

data WithParentArgs a Source #

This datatype wraps up the ParentArgs for a route fragment with the route fragment itself. A route fragment with its parent arguments can be rendered and dispatched on.

Since: 1.7.0.0

Constructors

WithParentArgs (ParentArgs a) a 

Instances

Instances details
(RedirectUrl master (Route master), ParentSite url ~ master, ToParentRoute url) => RedirectUrl master (WithParentArgs url) Source # 
Instance details

Defined in Yesod.Core.Handler

Methods

toTextUrl :: (MonadHandler m, HandlerSite m ~ master) => WithParentArgs url -> m Text Source #

(Eq (ParentArgs a), Eq a) => Eq (WithParentArgs a) Source # 
Instance details

Defined in Yesod.Routes.Class

Methods

(==) :: WithParentArgs a -> WithParentArgs a -> Bool

(/=) :: WithParentArgs a -> WithParentArgs a -> Bool

(Eq (ParentArgs a), RenderRouteNested a) => RenderRouteNested (WithParentArgs a) Source # 
Instance details

Defined in Yesod.Routes.Class

Associated Types

type ParentSite (WithParentArgs a) 
Instance details

Defined in Yesod.Routes.Class

type ParentArgs (WithParentArgs a) 
Instance details

Defined in Yesod.Routes.Class

Methods

renderRouteNested :: ParentArgs (WithParentArgs a) -> WithParentArgs a -> ([Text], [(Text, Text)]) Source #

(ParentSite route ~ site, YesodDispatchNested route, RedirectUrl site (WithParentArgs route), Yesod site, ToParentRoute route) => UrlToDispatch (WithParentArgs route) site Source #

This instance is the pattern upon which UrlToDispatch instances are generated for subsite fragments. Given the constraints, we are able to call toWaiAppYreNested at the route type with the correct arguments. This allows us to create an application for a fragment of a site.

Since: 1.7.0.0

Instance details

Defined in Yesod.Core.Class.Dispatch

type ParentArgs (WithParentArgs a) Source # 
Instance details

Defined in Yesod.Routes.Class

type ParentSite (WithParentArgs a) Source # 
Instance details

Defined in Yesod.Routes.Class

Utilities

maybeAuthorized Source #

Arguments

:: Yesod site 
=> Route site 
-> Bool

is this a write request?

-> HandlerT site IO (Maybe (Route site)) 

Return the same URL if the user is authorized to see it.

Built on top of isAuthorized. This is useful for building page that only contain links to pages the user is allowed to see.

widgetToPageContent :: Yesod site => WidgetFor site () -> HandlerFor site (PageContent (Route site)) Source #

Convert a widget to a PageContent.

Defaults

defaultErrorHandler :: Yesod site => ErrorResponse -> HandlerFor site TypedContent Source #

The default error handler for errorHandler.

defaultYesodMiddleware :: Yesod site => HandlerFor site res -> HandlerFor site res Source #

Default implementation of yesodMiddleware. Adds the response header "Vary: Accept, Accept-Language", "X-XSS-Protection: 1; mode=block", and performs authorization checks.

Since 1.2.0

authorizationCheck :: Yesod site => HandlerFor site () Source #

Check if a given request is authorized via isAuthorized and isWriteRequest.

Since 1.2.0

Data types

data AuthResult Source #

Instances

Instances details
Eq AuthResult Source # 
Instance details

Defined in Yesod.Core.Types

Methods

(==) :: AuthResult -> AuthResult -> Bool

(/=) :: AuthResult -> AuthResult -> Bool

Read AuthResult Source # 
Instance details

Defined in Yesod.Core.Types

Methods

readsPrec :: Int -> ReadS AuthResult

readList :: ReadS [AuthResult]

readPrec :: ReadPrec AuthResult

readListPrec :: ReadPrec [AuthResult]

Show AuthResult Source # 
Instance details

Defined in Yesod.Core.Types

Methods

showsPrec :: Int -> AuthResult -> ShowS

show :: AuthResult -> String

showList :: [AuthResult] -> ShowS

unauthorizedI :: (MonadHandler m, RenderMessage (HandlerSite m) msg) => msg -> m AuthResult Source #

Return an Unauthorized value, with the given i18n message.

Logging

defaultMakeLogger :: IO Logger Source #

Default implementation of makeLogger. Sends to stdout and automatically flushes on each write.

Since 1.4.10

defaultMessageLoggerSource Source #

Arguments

:: (LogSource -> LogLevel -> IO Bool)

Check whether we should log this

-> Logger 
-> Loc

position in source code

-> LogSource 
-> LogLevel 
-> LogStr

message

-> IO () 

Default implementation of messageLoggerSource. Checks if the message should be logged using the provided function, and if so, formats using formatLogMessage. You can use defaultShouldLogIO as the provided function.

Since 1.4.10

defaultShouldLogIO :: LogSource -> LogLevel -> IO Bool Source #

Default implementation of shouldLog. Logs everything at or above LevelInfo.

Since 1.4.10

formatLogMessage Source #

Arguments

:: IO ZonedDate 
-> Loc 
-> LogSource 
-> LogLevel 
-> LogStr

message

-> IO LogStr 

Default formatting for log messages. When you use the template haskell logging functions for to log with information about the source location, that information will be appended to the end of the log. When you use the non-TH logging functions, like logDebugN, this function does not include source information. This currently works by checking to see if the package name is the string "<unknown>". This is a hack, but it removes some of the visual clutter from non-TH logs.

Since 1.4.10

data LogLevel #

Instances

Instances details
Eq LogLevel # 
Instance details

Defined in Control.Monad.Logger

Methods

(==) :: LogLevel -> LogLevel -> Bool

(/=) :: LogLevel -> LogLevel -> Bool

Ord LogLevel # 
Instance details

Defined in Control.Monad.Logger

Methods

compare :: LogLevel -> LogLevel -> Ordering

(<) :: LogLevel -> LogLevel -> Bool

(<=) :: LogLevel -> LogLevel -> Bool

(>) :: LogLevel -> LogLevel -> Bool

(>=) :: LogLevel -> LogLevel -> Bool

max :: LogLevel -> LogLevel -> LogLevel

min :: LogLevel -> LogLevel -> LogLevel

Read LogLevel # 
Instance details

Defined in Control.Monad.Logger

Methods

readsPrec :: Int -> ReadS LogLevel

readList :: ReadS [LogLevel]

readPrec :: ReadPrec LogLevel

readListPrec :: ReadPrec [LogLevel]

Show LogLevel # 
Instance details

Defined in Control.Monad.Logger

Methods

showsPrec :: Int -> LogLevel -> ShowS

show :: LogLevel -> String

showList :: [LogLevel] -> ShowS

Lift LogLevel # 
Instance details

Defined in Control.Monad.Logger

Methods

lift :: Quote m => LogLevel -> m Exp

liftTyped :: forall (m :: Type -> Type). Quote m => LogLevel -> Code m LogLevel

logDebug :: Q Exp #

logInfo :: Q Exp #

logWarn :: Q Exp #

logError :: Q Exp #

logOther :: Text -> Q Exp #

logDebugS :: Q Exp #

logInfoS :: Q Exp #

logWarnS :: Q Exp #

logErrorS :: Q Exp #

logOtherS :: Q Exp #

Sessions

newtype SessionBackend Source #

Constructors

SessionBackend 

Fields

customizeSessionCookies :: (SetCookie -> SetCookie) -> SessionBackend -> SessionBackend Source #

Customize the cookies used by the session backend. You may use this function on your definition of makeSessionBackend.

For example, you could set the cookie domain so that it would work across many subdomains:

makeSessionBackend site =
    (fmap . fmap) (customizeSessionCookies addDomain) ...
  where
    addDomain cookie = cookie { setCookieDomain = Just ".example.com" }

Default: Do not customize anything (id).

defaultClientSessionBackend Source #

Arguments

:: Int

minutes

-> FilePath

key file

-> IO SessionBackend 

envClientSessionBackend Source #

Arguments

:: Int

minutes

-> String

environment variable name

-> IO SessionBackend 

Create a SessionBackend which reads the session key from the named environment variable.

This can be useful if:

  1. You can't rely on a persistent file system (e.g. Heroku)
  2. Your application is open source (e.g. you can't commit the key)

By keeping a consistent value in the environment variable, your users will have consistent sessions without relying on the file system.

Note: A suitable value should only be obtained in one of two ways:

  1. Run this code without the variable set, a value will be generated and printed on devstdout/
  2. Use clientsession-generate

Since 1.4.5

sslOnlySessions :: IO (Maybe SessionBackend) -> IO (Maybe SessionBackend) Source #

Defends against session hijacking by setting the secure bit on session cookies so that browsers will not transmit them over http. With this setting on, it follows that the server will regard requests made over http as sessionless, because the session cookie will not be included in the request. Use this as part of a total security measure which also includes disabling HTTP traffic to the site or issuing redirects from HTTP urls, and composing sslOnlyMiddleware with the site's yesodMiddleware.

Since 1.4.7

laxSameSiteSessions :: IO (Maybe SessionBackend) -> IO (Maybe SessionBackend) Source #

Helps defend against CSRF attacks by setting the SameSite attribute on session cookies to Lax. With the Lax setting, the cookie will be sent with same-site requests, and with cross-site top-level navigations.

This option is liable to change in future versions of Yesod as the spec evolves. View more information here.

Since: 1.4.23

strictSameSiteSessions :: IO (Maybe SessionBackend) -> IO (Maybe SessionBackend) Source #

Helps defend against CSRF attacks by setting the SameSite attribute on session cookies to Strict. With the Strict setting, the cookie will only be sent with same-site requests.

This option is liable to change in future versions of Yesod as the spec evolves. View more information here.

Since: 1.4.23

sslOnlyMiddleware Source #

Arguments

:: Int

minutes

-> HandlerFor site res 
-> HandlerFor site res 

Apply a Strict-Transport-Security header with the specified timeout to all responses so that browsers will rewrite all http links to https until the timeout expires. For security, the max-age of the STS header should always equal or exceed the client sessions timeout. This defends against SSL-stripping man-in-the-middle attacks. It is only effective if a secure connection has already been made; Strict-Transport-Security headers are ignored over HTTP.

Since 1.4.7

clientSessionDateCacher Source #

Arguments

:: NominalDiffTime

Inactive session validity.

-> IO (IO ClientSessionDateCache, IO ()) 

loadClientSession Source #

Arguments

:: Key 
-> IO ClientSessionDateCache

See clientSessionDateCacher

-> ByteString

session name

-> Request 
-> IO (SessionMap, SaveSession) 

data Header Source #

Headers to be added to a Result.

Constructors

AddCookie !SetCookie 
DeleteCookie !ByteString !ByteString

name and path

Header !(CI ByteString) !ByteString

key and value

Instances

Instances details
NFData Header Source # 
Instance details

Defined in Yesod.Core.Types

Methods

rnf :: Header -> ()

Eq Header Source # 
Instance details

Defined in Yesod.Core.Types

Methods

(==) :: Header -> Header -> Bool

(/=) :: Header -> Header -> Bool

Show Header Source # 
Instance details

Defined in Yesod.Core.Types

Methods

showsPrec :: Int -> Header -> ShowS

show :: Header -> String

showList :: [Header] -> ShowS

CSRF protection

defaultCsrfMiddleware :: Yesod site => HandlerFor site res -> HandlerFor site res Source #

Calls defaultCsrfSetCookieMiddleware and defaultCsrfCheckMiddleware.

For details, see the "AJAX CSRF protection" section of Yesod.Core.Handler.

You can chain this middleware together with other middleware like so:

yesodMiddleware = defaultYesodMiddleware . defaultCsrfMiddleware

or:

yesodMiddleware app = defaultYesodMiddleware $ defaultCsrfMiddleware $ app

Since 1.4.14

defaultCsrfSetCookieMiddleware :: HandlerFor site res -> HandlerFor site res Source #

Calls csrfSetCookieMiddleware with the defaultCsrfCookieName.

The cookie's path is set to /, making it valid for your whole website.

Since 1.4.14

csrfSetCookieMiddleware :: HandlerFor site res -> SetCookie -> HandlerFor site res Source #

Takes a SetCookie and overrides its value with a CSRF token, then sets the cookie. See setCsrfCookieWithCookie.

For details, see the "AJAX CSRF protection" section of Yesod.Core.Handler.

Make sure to set the setCookiePath to the root path of your application, otherwise you'll generate a new CSRF token for every path of your app. If your app is run from from e.g. www.example.com/app1, use app1. The vast majority of sites will just use /.

Since 1.4.14

csrfCheckMiddleware Source #

Arguments

:: HandlerFor site res 
-> HandlerFor site Bool

Whether or not to perform the CSRF check.

-> CI ByteString

The header name to lookup the CSRF token from.

-> Text

The POST parameter name to lookup the CSRF token from.

-> HandlerFor site res 

Looks up the CSRF token from the request headers or POST parameters. If the value doesn't match the token stored in the session, this function throws a PermissionDenied error.

For details, see the "AJAX CSRF protection" section of Yesod.Core.Handler.

Since 1.4.14

JS loaders

type BottomOfHeadAsync master Source #

Arguments

 = [Text]

urls to load asynchronously

-> Maybe (HtmlUrl (Route master))

widget of js to run on async completion

-> HtmlUrl (Route master)

widget to insert at the bottom of head

Generalizing type classes

class (MonadResource m, MonadLogger m) => MonadHandler (m :: Type -> Type) where Source #

Associated Types

type HandlerSite (m :: Type -> Type) Source #

type SubHandlerSite (m :: Type -> Type) Source #

Instances

Instances details
MonadHandler m => MonadHandler (MaybeT m) Source # 
Instance details

Defined in Yesod.Core.Class.Handler

Associated Types

type HandlerSite (MaybeT m) 
Instance details

Defined in Yesod.Core.Class.Handler

type HandlerSite (MaybeT m) = HandlerSite m
type SubHandlerSite (MaybeT m) 
Instance details

Defined in Yesod.Core.Class.Handler

type SubHandlerSite (MaybeT m) = SubHandlerSite m

Methods

liftHandler :: HandlerFor (HandlerSite (MaybeT m)) a -> MaybeT m a Source #

liftSubHandler :: SubHandlerFor (SubHandlerSite (MaybeT m)) (HandlerSite (MaybeT m)) a -> MaybeT m a Source #

MonadHandler (HandlerFor site) Source # 
Instance details

Defined in Yesod.Core.Class.Handler

Associated Types

type HandlerSite (HandlerFor site) 
Instance details

Defined in Yesod.Core.Class.Handler

type HandlerSite (HandlerFor site) = site
type SubHandlerSite (HandlerFor site) 
Instance details

Defined in Yesod.Core.Class.Handler

type SubHandlerSite (HandlerFor site) = site
MonadHandler (WidgetFor site) Source # 
Instance details

Defined in Yesod.Core.Class.Handler

Associated Types

type HandlerSite (WidgetFor site) 
Instance details

Defined in Yesod.Core.Class.Handler

type HandlerSite (WidgetFor site) = site
type SubHandlerSite (WidgetFor site) 
Instance details

Defined in Yesod.Core.Class.Handler

type SubHandlerSite (WidgetFor site) = site
MonadHandler m => MonadHandler (ExceptT e m) Source # 
Instance details

Defined in Yesod.Core.Class.Handler

Associated Types

type HandlerSite (ExceptT e m) 
Instance details

Defined in Yesod.Core.Class.Handler

type HandlerSite (ExceptT e m) = HandlerSite m
type SubHandlerSite (ExceptT e m) 
Instance details

Defined in Yesod.Core.Class.Handler

type SubHandlerSite (ExceptT e m) = SubHandlerSite m

Methods

liftHandler :: HandlerFor (HandlerSite (ExceptT e m)) a -> ExceptT e m a Source #

liftSubHandler :: SubHandlerFor (SubHandlerSite (ExceptT e m)) (HandlerSite (ExceptT e m)) a -> ExceptT e m a Source #

MonadHandler m => MonadHandler (IdentityT m) Source # 
Instance details

Defined in Yesod.Core.Class.Handler

Associated Types

type HandlerSite (IdentityT m) 
Instance details

Defined in Yesod.Core.Class.Handler

type HandlerSite (IdentityT m) = HandlerSite m
type SubHandlerSite (IdentityT m) 
Instance details

Defined in Yesod.Core.Class.Handler

type SubHandlerSite (IdentityT m) = SubHandlerSite m

Methods

liftHandler :: HandlerFor (HandlerSite (IdentityT m)) a -> IdentityT m a Source #

liftSubHandler :: SubHandlerFor (SubHandlerSite (IdentityT m)) (HandlerSite (IdentityT m)) a -> IdentityT m a Source #

MonadHandler m => MonadHandler (ReaderT r m) Source # 
Instance details

Defined in Yesod.Core.Class.Handler

Associated Types

type HandlerSite (ReaderT r m) 
Instance details

Defined in Yesod.Core.Class.Handler

type HandlerSite (ReaderT r m) = HandlerSite m
type SubHandlerSite (ReaderT r m) 
Instance details

Defined in Yesod.Core.Class.Handler

type SubHandlerSite (ReaderT r m) = SubHandlerSite m

Methods

liftHandler :: HandlerFor (HandlerSite (ReaderT r m)) a -> ReaderT r m a Source #

liftSubHandler :: SubHandlerFor (SubHandlerSite (ReaderT r m)) (HandlerSite (ReaderT r m)) a -> ReaderT r m a Source #

MonadHandler m => MonadHandler (StateT s m) Source # 
Instance details

Defined in Yesod.Core.Class.Handler

Associated Types

type HandlerSite (StateT s m) 
Instance details

Defined in Yesod.Core.Class.Handler

type HandlerSite (StateT s m) = HandlerSite m
type SubHandlerSite (StateT s m) 
Instance details

Defined in Yesod.Core.Class.Handler

type SubHandlerSite (StateT s m) = SubHandlerSite m

Methods

liftHandler :: HandlerFor (HandlerSite (StateT s m)) a -> StateT s m a Source #

liftSubHandler :: SubHandlerFor (SubHandlerSite (StateT s m)) (HandlerSite (StateT s m)) a -> StateT s m a Source #

MonadHandler m => MonadHandler (StateT s m) Source # 
Instance details

Defined in Yesod.Core.Class.Handler

Associated Types

type HandlerSite (StateT s m) 
Instance details

Defined in Yesod.Core.Class.Handler

type HandlerSite (StateT s m) = HandlerSite m
type SubHandlerSite (StateT s m) 
Instance details

Defined in Yesod.Core.Class.Handler

type SubHandlerSite (StateT s m) = SubHandlerSite m

Methods

liftHandler :: HandlerFor (HandlerSite (StateT s m)) a -> StateT s m a Source #

liftSubHandler :: SubHandlerFor (SubHandlerSite (StateT s m)) (HandlerSite (StateT s m)) a -> StateT s m a Source #

(Monoid w, MonadHandler m) => MonadHandler (WriterT w m) Source # 
Instance details

Defined in Yesod.Core.Class.Handler

Associated Types

type HandlerSite (WriterT w m) 
Instance details

Defined in Yesod.Core.Class.Handler

type HandlerSite (WriterT w m) = HandlerSite m
type SubHandlerSite (WriterT w m) 
Instance details

Defined in Yesod.Core.Class.Handler

type SubHandlerSite (WriterT w m) = SubHandlerSite m

Methods

liftHandler :: HandlerFor (HandlerSite (WriterT w m)) a -> WriterT w m a Source #

liftSubHandler :: SubHandlerFor (SubHandlerSite (WriterT w m)) (HandlerSite (WriterT w m)) a -> WriterT w m a Source #

(Monoid w, MonadHandler m) => MonadHandler (WriterT w m) Source # 
Instance details

Defined in Yesod.Core.Class.Handler

Associated Types

type HandlerSite (WriterT w m) 
Instance details

Defined in Yesod.Core.Class.Handler

type HandlerSite (WriterT w m) = HandlerSite m
type SubHandlerSite (WriterT w m) 
Instance details

Defined in Yesod.Core.Class.Handler

type SubHandlerSite (WriterT w m) = SubHandlerSite m

Methods

liftHandler :: HandlerFor (HandlerSite (WriterT w m)) a -> WriterT w m a Source #

liftSubHandler :: SubHandlerFor (SubHandlerSite (WriterT w m)) (HandlerSite (WriterT w m)) a -> WriterT w m a Source #

MonadHandler (SubHandlerFor sub master) Source # 
Instance details

Defined in Yesod.Core.Class.Handler

Associated Types

type HandlerSite (SubHandlerFor sub master) 
Instance details

Defined in Yesod.Core.Class.Handler

type HandlerSite (SubHandlerFor sub master) = master
type SubHandlerSite (SubHandlerFor sub master) 
Instance details

Defined in Yesod.Core.Class.Handler

type SubHandlerSite (SubHandlerFor sub master) = sub
MonadHandler m => MonadHandler (ConduitM i o m) Source # 
Instance details

Defined in Yesod.Core.Class.Handler

Associated Types

type HandlerSite (ConduitM i o m) 
Instance details

Defined in Yesod.Core.Class.Handler

type HandlerSite (ConduitM i o m) = HandlerSite m
type SubHandlerSite (ConduitM i o m) 
Instance details

Defined in Yesod.Core.Class.Handler

type SubHandlerSite (ConduitM i o m) = SubHandlerSite m

Methods

liftHandler :: HandlerFor (HandlerSite (ConduitM i o m)) a -> ConduitM i o m a Source #

liftSubHandler :: SubHandlerFor (SubHandlerSite (ConduitM i o m)) (HandlerSite (ConduitM i o m)) a -> ConduitM i o m a Source #

(Monoid w, MonadHandler m) => MonadHandler (RWST r w s m) Source # 
Instance details

Defined in Yesod.Core.Class.Handler

Associated Types

type HandlerSite (RWST r w s m) 
Instance details

Defined in Yesod.Core.Class.Handler

type HandlerSite (RWST r w s m) = HandlerSite m
type SubHandlerSite (RWST r w s m) 
Instance details

Defined in Yesod.Core.Class.Handler

type SubHandlerSite (RWST r w s m) = SubHandlerSite m

Methods

liftHandler :: HandlerFor (HandlerSite (RWST r w s m)) a -> RWST r w s m a Source #

liftSubHandler :: SubHandlerFor (SubHandlerSite (RWST r w s m)) (HandlerSite (RWST r w s m)) a -> RWST r w s m a Source #

(Monoid w, MonadHandler m) => MonadHandler (RWST r w s m) Source # 
Instance details

Defined in Yesod.Core.Class.Handler

Associated Types

type HandlerSite (RWST r w s m) 
Instance details

Defined in Yesod.Core.Class.Handler

type HandlerSite (RWST r w s m) = HandlerSite m
type SubHandlerSite (RWST r w s m) 
Instance details

Defined in Yesod.Core.Class.Handler

type SubHandlerSite (RWST r w s m) = SubHandlerSite m

Methods

liftHandler :: HandlerFor (HandlerSite (RWST r w s m)) a -> RWST r w s m a Source #

liftSubHandler :: SubHandlerFor (SubHandlerSite (RWST r w s m)) (HandlerSite (RWST r w s m)) a -> RWST r w s m a Source #

MonadHandler m => MonadHandler (Pipe l i o u m) Source # 
Instance details

Defined in Yesod.Core.Class.Handler

Associated Types

type HandlerSite (Pipe l i o u m) 
Instance details

Defined in Yesod.Core.Class.Handler

type HandlerSite (Pipe l i o u m) = HandlerSite m
type SubHandlerSite (Pipe l i o u m) 
Instance details

Defined in Yesod.Core.Class.Handler

type SubHandlerSite (Pipe l i o u m) = SubHandlerSite m

Methods

liftHandler :: HandlerFor (HandlerSite (Pipe l i o u m)) a -> Pipe l i o u m a Source #

liftSubHandler :: SubHandlerFor (SubHandlerSite (Pipe l i o u m)) (HandlerSite (Pipe l i o u m)) a -> Pipe l i o u m a Source #

class MonadHandler m => MonadWidget (m :: Type -> Type) where Source #

Methods

liftWidget :: WidgetFor (HandlerSite m) a -> m a Source #

Instances

Instances details
MonadWidget m => MonadWidget (MaybeT m) Source # 
Instance details

Defined in Yesod.Core.Class.Handler

Methods

liftWidget :: WidgetFor (HandlerSite (MaybeT m)) a -> MaybeT m a Source #

MonadWidget (WidgetFor site) Source # 
Instance details

Defined in Yesod.Core.Class.Handler

Methods

liftWidget :: WidgetFor (HandlerSite (WidgetFor site)) a -> WidgetFor site a Source #

MonadWidget m => MonadWidget (ExceptT e m) Source # 
Instance details

Defined in Yesod.Core.Class.Handler

Methods

liftWidget :: WidgetFor (HandlerSite (ExceptT e m)) a -> ExceptT e m a Source #

MonadWidget m => MonadWidget (IdentityT m) Source # 
Instance details

Defined in Yesod.Core.Class.Handler

Methods

liftWidget :: WidgetFor (HandlerSite (IdentityT m)) a -> IdentityT m a Source #

MonadWidget m => MonadWidget (ReaderT r m) Source # 
Instance details

Defined in Yesod.Core.Class.Handler

Methods

liftWidget :: WidgetFor (HandlerSite (ReaderT r m)) a -> ReaderT r m a Source #

MonadWidget m => MonadWidget (StateT s m) Source # 
Instance details

Defined in Yesod.Core.Class.Handler

Methods

liftWidget :: WidgetFor (HandlerSite (StateT s m)) a -> StateT s m a Source #

MonadWidget m => MonadWidget (StateT s m) Source # 
Instance details

Defined in Yesod.Core.Class.Handler

Methods

liftWidget :: WidgetFor (HandlerSite (StateT s m)) a -> StateT s m a Source #

(Monoid w, MonadWidget m) => MonadWidget (WriterT w m) Source # 
Instance details

Defined in Yesod.Core.Class.Handler

Methods

liftWidget :: WidgetFor (HandlerSite (WriterT w m)) a -> WriterT w m a Source #

(Monoid w, MonadWidget m) => MonadWidget (WriterT w m) Source # 
Instance details

Defined in Yesod.Core.Class.Handler

Methods

liftWidget :: WidgetFor (HandlerSite (WriterT w m)) a -> WriterT w m a Source #

MonadWidget m => MonadWidget (ConduitM i o m) Source # 
Instance details

Defined in Yesod.Core.Class.Handler

Methods

liftWidget :: WidgetFor (HandlerSite (ConduitM i o m)) a -> ConduitM i o m a Source #

(Monoid w, MonadWidget m) => MonadWidget (RWST r w s m) Source # 
Instance details

Defined in Yesod.Core.Class.Handler

Methods

liftWidget :: WidgetFor (HandlerSite (RWST r w s m)) a -> RWST r w s m a Source #

(Monoid w, MonadWidget m) => MonadWidget (RWST r w s m) Source # 
Instance details

Defined in Yesod.Core.Class.Handler

Methods

liftWidget :: WidgetFor (HandlerSite (RWST r w s m)) a -> RWST r w s m a Source #

MonadWidget m => MonadWidget (Pipe l i o u m) Source # 
Instance details

Defined in Yesod.Core.Class.Handler

Methods

liftWidget :: WidgetFor (HandlerSite (Pipe l i o u m)) a -> Pipe l i o u m a Source #

Approot

guessApproot :: Approot site Source #

Guess the approot based on request headers. For more information, see Network.Wai.Middleware.Approot

In the case of headers being unavailable, it falls back to ApprootRelative

Since 1.4.16

guessApprootOr :: Approot site -> Approot site Source #

Guess the approot based on request headers, with fall back to the specified AppRoot.

Since 1.4.16

getApprootText :: Approot site -> site -> Request -> Text Source #

Get the textual application root from an Approot value.

Since 1.4.17

Misc

yesodRender Source #

Arguments

:: Yesod y 
=> y 
-> ResolvedApproot 
-> Route y 
-> [(Text, Text)]

url query string

-> Text 

runFakeHandler :: (Yesod site, MonadIO m) => SessionMap -> (site -> Logger) -> site -> HandlerT site IO a -> m (Either ErrorResponse a) Source #

Deprecated: import runFakeHandler from Yesod.Core.Unsafe

LiteApp

liteApp :: Writer LiteApp () -> LiteApp Source #

onMethod :: Method -> Writer LiteApp () -> Writer LiteApp () Source #

onStatic :: Text -> Writer LiteApp () -> Writer LiteApp () Source #

withDynamic :: PathPiece p => (p -> Writer LiteApp ()) -> Writer LiteApp () Source #

withDynamicMulti :: PathMultiPiece ps => (ps -> Writer LiteApp ()) -> Writer LiteApp () Source #

newtype LiteApp Source #

Constructors

LiteApp 

Fields

Instances

Instances details
Monoid LiteApp Source # 
Instance details

Defined in Yesod.Core.Internal.LiteApp

Semigroup LiteApp Source # 
Instance details

Defined in Yesod.Core.Internal.LiteApp

Methods

(<>) :: LiteApp -> LiteApp -> LiteApp

sconcat :: NonEmpty LiteApp -> LiteApp

stimes :: Integral b => b -> LiteApp -> LiteApp

YesodDispatch LiteApp Source # 
Instance details

Defined in Yesod.Core.Internal.LiteApp

Yesod LiteApp Source # 
Instance details

Defined in Yesod.Core.Internal.LiteApp

Methods

approot :: Approot LiteApp Source #

catchHandlerExceptions :: MonadUnliftIO m => LiteApp -> m a -> (SomeException -> m a) -> m a Source #

errorHandler :: ErrorResponse -> HandlerFor LiteApp TypedContent Source #

defaultLayout :: WidgetFor LiteApp () -> HandlerFor LiteApp Html Source #

urlParamRenderOverride :: LiteApp -> Route LiteApp -> [(Text, Text)] -> Maybe Builder Source #

isAuthorized :: Route LiteApp -> Bool -> HandlerFor LiteApp AuthResult Source #

isWriteRequest :: Route LiteApp -> HandlerFor LiteApp Bool Source #

authRoute :: LiteApp -> Maybe (Route LiteApp) Source #

cleanPath :: LiteApp -> [Text] -> Either [Text] [Text] Source #

joinPath :: LiteApp -> Text -> [Text] -> [(Text, Text)] -> Builder Source #

addStaticContent :: Text -> Text -> ByteString -> HandlerFor LiteApp (Maybe (Either Text (Route LiteApp, [(Text, Text)]))) Source #

maximumContentLength :: LiteApp -> Maybe (Route LiteApp) -> Maybe Word64 Source #

maximumContentLengthIO :: LiteApp -> Maybe (Route LiteApp) -> IO (Maybe Word64) Source #

makeLogger :: LiteApp -> IO Logger Source #

messageLoggerSource :: LiteApp -> Logger -> Loc -> LogSource -> LogLevel -> LogStr -> IO () Source #

jsLoader :: LiteApp -> ScriptLoadPosition LiteApp Source #

jsAttributes :: LiteApp -> [(Text, Text)] Source #

jsAttributesHandler :: HandlerFor LiteApp [(Text, Text)] Source #

makeSessionBackend :: LiteApp -> IO (Maybe SessionBackend) Source #

fileUpload :: LiteApp -> RequestBodyLength -> FileUpload Source #

shouldLogIO :: LiteApp -> LogSource -> LogLevel -> IO Bool Source #

yesodMiddleware :: ToTypedContent res => HandlerFor LiteApp res -> HandlerFor LiteApp res Source #

yesodWithInternalState :: LiteApp -> Maybe (Route LiteApp) -> (InternalState -> IO a) -> IO a Source #

defaultMessageWidget :: Html -> HtmlUrl (Route LiteApp) -> WidgetFor LiteApp () Source #

ParseRoute LiteApp Source # 
Instance details

Defined in Yesod.Core.Internal.LiteApp

Methods

parseRoute :: ([Text], [(Text, Text)]) -> Maybe (Route LiteApp) Source #

RenderRoute LiteApp Source # 
Instance details

Defined in Yesod.Core.Internal.LiteApp

Associated Types

data Route LiteApp 
Instance details

Defined in Yesod.Core.Internal.LiteApp

data Route LiteApp = LiteAppRoute [Text]

Methods

renderRoute :: Route LiteApp -> ([Text], [(Text, Text)]) Source #

Eq (Route LiteApp) Source # 
Instance details

Defined in Yesod.Core.Internal.LiteApp

Methods

(==) :: Route LiteApp -> Route LiteApp -> Bool

(/=) :: Route LiteApp -> Route LiteApp -> Bool

Ord (Route LiteApp) Source # 
Instance details

Defined in Yesod.Core.Internal.LiteApp

Read (Route LiteApp) Source # 
Instance details

Defined in Yesod.Core.Internal.LiteApp

Methods

readsPrec :: Int -> ReadS (Route LiteApp)

readList :: ReadS [Route LiteApp]

readPrec :: ReadPrec (Route LiteApp)

readListPrec :: ReadPrec [Route LiteApp]

Show (Route LiteApp) Source # 
Instance details

Defined in Yesod.Core.Internal.LiteApp

Methods

showsPrec :: Int -> Route LiteApp -> ShowS

show :: Route LiteApp -> String

showList :: [Route LiteApp] -> ShowS

data Route LiteApp Source # 
Instance details

Defined in Yesod.Core.Internal.LiteApp

data Route LiteApp = LiteAppRoute [Text]

data family Route a Source #

The type-safe URLs associated with a site argument.

Instances

Instances details
RedirectUrl master (Route master) Source # 
Instance details

Defined in Yesod.Core.Handler

Methods

toTextUrl :: (MonadHandler m, HandlerSite m ~ master) => Route master -> m Text Source #

(key ~ Text, val ~ Text) => RedirectUrl master (Route master, Map key val) Source # 
Instance details

Defined in Yesod.Core.Handler

Methods

toTextUrl :: (MonadHandler m, HandlerSite m ~ master) => (Route master, Map key val) -> m Text Source #

(key ~ Text, val ~ Text) => RedirectUrl master (Route master, [(key, val)]) Source # 
Instance details

Defined in Yesod.Core.Handler

Methods

toTextUrl :: (MonadHandler m, HandlerSite m ~ master) => (Route master, [(key, val)]) -> m Text Source #

Eq (Route LiteApp) 
Instance details

Defined in Yesod.Core.Internal.LiteApp

Methods

(==) :: Route LiteApp -> Route LiteApp -> Bool

(/=) :: Route LiteApp -> Route LiteApp -> Bool

Eq (Route WaiSubsite) 
Instance details

Defined in Yesod.Core.Types

Eq (Route WaiSubsiteWithAuth) 
Instance details

Defined in Yesod.Core.Types

Ord (Route LiteApp) 
Instance details

Defined in Yesod.Core.Internal.LiteApp

Ord (Route WaiSubsite) 
Instance details

Defined in Yesod.Core.Types

Ord (Route WaiSubsiteWithAuth) 
Instance details

Defined in Yesod.Core.Types

Read (Route LiteApp) 
Instance details

Defined in Yesod.Core.Internal.LiteApp

Methods

readsPrec :: Int -> ReadS (Route LiteApp)

readList :: ReadS [Route LiteApp]

readPrec :: ReadPrec (Route LiteApp)

readListPrec :: ReadPrec [Route LiteApp]

Read (Route WaiSubsite) 
Instance details

Defined in Yesod.Core.Types

Methods

readsPrec :: Int -> ReadS (Route WaiSubsite)

readList :: ReadS [Route WaiSubsite]

readPrec :: ReadPrec (Route WaiSubsite)

readListPrec :: ReadPrec [Route WaiSubsite]

Read (Route WaiSubsiteWithAuth) 
Instance details

Defined in Yesod.Core.Types

Show (Route LiteApp) 
Instance details

Defined in Yesod.Core.Internal.LiteApp

Methods

showsPrec :: Int -> Route LiteApp -> ShowS

show :: Route LiteApp -> String

showList :: [Route LiteApp] -> ShowS

Show (Route WaiSubsite) 
Instance details

Defined in Yesod.Core.Types

Methods

showsPrec :: Int -> Route WaiSubsite -> ShowS

show :: Route WaiSubsite -> String

showList :: [Route WaiSubsite] -> ShowS

Show (Route WaiSubsiteWithAuth) 
Instance details

Defined in Yesod.Core.Types

YesodDispatch site => YesodDispatchNested (Route site) Source #

YesodDispatchNested is a more flexible class than YesodDispatch, and this instance is the proof. Given a Route site we can dispatch on it as normal, so this code path works. This allows us to create generalized helpers and reuse them, ensuring that nested and top-level dispatch remain equivalent. This instance therefore always returns Just — committing to yesodDispatch, which itself terminates in a 404 on a miss — rather than the Nothing that the class haddock describes for fragment instances. The only intended caller is the terminal authority toWaiAppYreNested, where that 404 is exactly the right answer; do not rely on this instance to signal fallthrough.

Instance details

Defined in Yesod.Core.Class.Dispatch

Methods

yesodDispatchNested :: Proxy (Route site) -> ParentArgs (Route site) -> (Route site -> Route (ParentSite (Route site))) -> YesodRunnerEnv (ParentSite (Route site)) -> Request -> Maybe ((Response -> IO ResponseReceived) -> IO ResponseReceived) Source #

RenderRoute a => ToParentRoute (Route a) Source # 
Instance details

Defined in Yesod.Core.Class.Dispatch.ToParentRoute

RenderRoute site => RenderRouteNested (Route site) Source # 
Instance details

Defined in Yesod.Routes.Class

Associated Types

type ParentSite (Route site) 
Instance details

Defined in Yesod.Routes.Class

type ParentSite (Route site) = site
type ParentArgs (Route site) 
Instance details

Defined in Yesod.Routes.Class

type ParentArgs (Route site) = ()

Methods

renderRouteNested :: ParentArgs (Route site) -> Route site -> ([Text], [(Text, Text)]) Source #

YesodDispatch site => UrlToDispatch (Route site) site Source # 
Instance details

Defined in Yesod.Core.Class.Dispatch

(YesodDispatch site, RedirectUrl site (Route site, a)) => UrlToDispatch (Route site, a) site Source # 
Instance details

Defined in Yesod.Core.Class.Dispatch

Methods

urlToDispatch :: (Route site, a) -> YesodRunnerEnv site -> Application Source #

data Route LiteApp Source # 
Instance details

Defined in Yesod.Core.Internal.LiteApp

data Route LiteApp = LiteAppRoute [Text]
data Route WaiSubsite Source # 
Instance details

Defined in Yesod.Core.Types

data Route WaiSubsite = WaiSubsiteRoute [Text] [(Text, Text)]
data Route WaiSubsiteWithAuth Source # 
Instance details

Defined in Yesod.Core.Types

data Route WaiSubsiteWithAuth = WaiSubsiteWithAuthRoute [Text] [(Text, Text)]
type ParentArgs (Route site) Source # 
Instance details

Defined in Yesod.Routes.Class

type ParentArgs (Route site) = ()
type ParentSite (Route site) Source # 
Instance details

Defined in Yesod.Routes.Class

type ParentSite (Route site) = site

data family Route a Source #

The type-safe URLs associated with a site argument.

Instances

Instances details
RedirectUrl master (Route master) Source # 
Instance details

Defined in Yesod.Core.Handler

Methods

toTextUrl :: (MonadHandler m, HandlerSite m ~ master) => Route master -> m Text Source #

(key ~ Text, val ~ Text) => RedirectUrl master (Route master, Map key val) Source # 
Instance details

Defined in Yesod.Core.Handler

Methods

toTextUrl :: (MonadHandler m, HandlerSite m ~ master) => (Route master, Map key val) -> m Text Source #

(key ~ Text, val ~ Text) => RedirectUrl master (Route master, [(key, val)]) Source # 
Instance details

Defined in Yesod.Core.Handler

Methods

toTextUrl :: (MonadHandler m, HandlerSite m ~ master) => (Route master, [(key, val)]) -> m Text Source #

Eq (Route LiteApp) 
Instance details

Defined in Yesod.Core.Internal.LiteApp

Methods

(==) :: Route LiteApp -> Route LiteApp -> Bool

(/=) :: Route LiteApp -> Route LiteApp -> Bool

Eq (Route WaiSubsite) 
Instance details

Defined in Yesod.Core.Types

Eq (Route WaiSubsiteWithAuth) 
Instance details

Defined in Yesod.Core.Types

Ord (Route LiteApp) 
Instance details

Defined in Yesod.Core.Internal.LiteApp

Ord (Route WaiSubsite) 
Instance details

Defined in Yesod.Core.Types

Ord (Route WaiSubsiteWithAuth) 
Instance details

Defined in Yesod.Core.Types

Read (Route LiteApp) 
Instance details

Defined in Yesod.Core.Internal.LiteApp

Methods

readsPrec :: Int -> ReadS (Route LiteApp)

readList :: ReadS [Route LiteApp]

readPrec :: ReadPrec (Route LiteApp)

readListPrec :: ReadPrec [Route LiteApp]

Read (Route WaiSubsite) 
Instance details

Defined in Yesod.Core.Types

Methods

readsPrec :: Int -> ReadS (Route WaiSubsite)

readList :: ReadS [Route WaiSubsite]

readPrec :: ReadPrec (Route WaiSubsite)

readListPrec :: ReadPrec [Route WaiSubsite]

Read (Route WaiSubsiteWithAuth) 
Instance details

Defined in Yesod.Core.Types

Show (Route LiteApp) 
Instance details

Defined in Yesod.Core.Internal.LiteApp

Methods

showsPrec :: Int -> Route LiteApp -> ShowS

show :: Route LiteApp -> String

showList :: [Route LiteApp] -> ShowS

Show (Route WaiSubsite) 
Instance details

Defined in Yesod.Core.Types

Methods

showsPrec :: Int -> Route WaiSubsite -> ShowS

show :: Route WaiSubsite -> String

showList :: [Route WaiSubsite] -> ShowS

Show (Route WaiSubsiteWithAuth) 
Instance details

Defined in Yesod.Core.Types

YesodDispatch site => YesodDispatchNested (Route site) Source #

YesodDispatchNested is a more flexible class than YesodDispatch, and this instance is the proof. Given a Route site we can dispatch on it as normal, so this code path works. This allows us to create generalized helpers and reuse them, ensuring that nested and top-level dispatch remain equivalent. This instance therefore always returns Just — committing to yesodDispatch, which itself terminates in a 404 on a miss — rather than the Nothing that the class haddock describes for fragment instances. The only intended caller is the terminal authority toWaiAppYreNested, where that 404 is exactly the right answer; do not rely on this instance to signal fallthrough.

Instance details

Defined in Yesod.Core.Class.Dispatch

Methods

yesodDispatchNested :: Proxy (Route site) -> ParentArgs (Route site) -> (Route site -> Route (ParentSite (Route site))) -> YesodRunnerEnv (ParentSite (Route site)) -> Request -> Maybe ((Response -> IO ResponseReceived) -> IO ResponseReceived) Source #

RenderRoute a => ToParentRoute (Route a) Source # 
Instance details

Defined in Yesod.Core.Class.Dispatch.ToParentRoute

RenderRoute site => RenderRouteNested (Route site) Source # 
Instance details

Defined in Yesod.Routes.Class

Associated Types

type ParentSite (Route site) 
Instance details

Defined in Yesod.Routes.Class

type ParentSite (Route site) = site
type ParentArgs (Route site) 
Instance details

Defined in Yesod.Routes.Class

type ParentArgs (Route site) = ()

Methods

renderRouteNested :: ParentArgs (Route site) -> Route site -> ([Text], [(Text, Text)]) Source #

YesodDispatch site => UrlToDispatch (Route site) site Source # 
Instance details

Defined in Yesod.Core.Class.Dispatch

(YesodDispatch site, RedirectUrl site (Route site, a)) => UrlToDispatch (Route site, a) site Source # 
Instance details

Defined in Yesod.Core.Class.Dispatch

Methods

urlToDispatch :: (Route site, a) -> YesodRunnerEnv site -> Application Source #

data Route LiteApp Source # 
Instance details

Defined in Yesod.Core.Internal.LiteApp

data Route LiteApp = LiteAppRoute [Text]
data Route WaiSubsite Source # 
Instance details

Defined in Yesod.Core.Types

data Route WaiSubsite = WaiSubsiteRoute [Text] [(Text, Text)]
data Route WaiSubsiteWithAuth Source # 
Instance details

Defined in Yesod.Core.Types

data Route WaiSubsiteWithAuth = WaiSubsiteWithAuthRoute [Text] [(Text, Text)]
type ParentArgs (Route site) Source # 
Instance details

Defined in Yesod.Routes.Class

type ParentArgs (Route site) = ()
type ParentSite (Route site) Source # 
Instance details

Defined in Yesod.Routes.Class

type ParentSite (Route site) = site

Low-level

yesodRunner :: (ToTypedContent res, Yesod site) => HandlerFor site res -> YesodRunnerEnv site -> Maybe (Route site) -> Application Source #

Re-exports

mkMessage :: String -> FilePath -> Lang -> Q [Dec] #

mkMessageFor :: String -> String -> FilePath -> Lang -> Q [Dec] #

mkMessageOpts :: MakeMessageOpts -> String -> String -> FilePath -> Lang -> Q [Dec] #

mkMessageVariant :: String -> String -> FilePath -> Lang -> Q [Dec] #

type Lang = Text #

class RenderMessage master message where #

Methods

renderMessage :: master -> [Lang] -> message -> Text #

Instances

Instances details
RenderMessage master Text # 
Instance details

Defined in Text.Shakespeare.I18N

Methods

renderMessage :: master -> [Lang] -> Text -> Text #

master ~ master' => RenderMessage master (SomeMessage master') # 
Instance details

Defined in Text.Shakespeare.I18N

Methods

renderMessage :: master -> [Lang] -> SomeMessage master' -> Text #

data SomeMessage master #

Constructors

RenderMessage master msg => SomeMessage msg 

Instances

Instances details
master ~ master' => RenderMessage master (SomeMessage master') # 
Instance details

Defined in Text.Shakespeare.I18N

Methods

renderMessage :: master -> [Lang] -> SomeMessage master' -> Text #

IsString (SomeMessage master) # 
Instance details

Defined in Text.Shakespeare.I18N

Methods

fromString :: String -> SomeMessage master

class ToMessage a where #

Methods

toMessage :: a -> Text #

Instances

Instances details
ToMessage Text # 
Instance details

Defined in Text.Shakespeare.I18N

Methods

toMessage :: Text -> Text #

ToMessage String # 
Instance details

Defined in Text.Shakespeare.I18N

Methods

toMessage :: String -> Text #

formatRFC1123 :: UTCTime -> Text Source #

Format as per RFC 1123.

formatRFC822 :: UTCTime -> Text Source #

Format as per RFC 822.

formatW3 :: UTCTime -> Text Source #

Format a UTCTime in W3 format.

toHtml :: ToMarkup a => a -> Html #

type Html = Markup #

preEscapedToMarkup :: ToMarkup a => a -> Markup #

class (forall (m :: Type -> Type). Monad m => Monad (t m)) => MonadTrans (t :: (Type -> Type) -> Type -> Type) where #

Methods

lift :: Monad m => m a -> t m a #

Instances

Instances details
MonadTrans CatchT # 
Instance details

Defined in Control.Monad.Catch.Pure

Methods

lift :: Monad m => m a -> CatchT m a #

MonadTrans LoggingT # 
Instance details

Defined in Control.Monad.Logger

Methods

lift :: Monad m => m a -> LoggingT m a #

MonadTrans NoLoggingT # 
Instance details

Defined in Control.Monad.Logger

Methods

lift :: Monad m => m a -> NoLoggingT m a #

MonadTrans WriterLoggingT # 
Instance details

Defined in Control.Monad.Logger

Methods

lift :: Monad m => m a -> WriterLoggingT m a #

MonadTrans ResourceT # 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

lift :: Monad m => m a -> ResourceT m a #

MonadTrans MaybeT # 
Instance details

Defined in Control.Monad.Trans.Maybe

Methods

lift :: Monad m => m a -> MaybeT m a #

Monoid w => MonadTrans (AccumT w) # 
Instance details

Defined in Control.Monad.Trans.Accum

Methods

lift :: Monad m => m a -> AccumT w m a #

MonadTrans (ExceptT e) # 
Instance details

Defined in Control.Monad.Trans.Except

Methods

lift :: Monad m => m a -> ExceptT e m a #

MonadTrans (IdentityT :: (Type -> Type) -> Type -> Type) # 
Instance details

Defined in Control.Monad.Trans.Identity

Methods

lift :: Monad m => m a -> IdentityT m a #

MonadTrans (ReaderT r) # 
Instance details

Defined in Control.Monad.Trans.Reader

Methods

lift :: Monad m => m a -> ReaderT r m a #

MonadTrans (SelectT r) # 
Instance details

Defined in Control.Monad.Trans.Select

Methods

lift :: Monad m => m a -> SelectT r m a #

MonadTrans (StateT s) # 
Instance details

Defined in Control.Monad.Trans.State.Lazy

Methods

lift :: Monad m => m a -> StateT s m a #

MonadTrans (StateT s) # 
Instance details

Defined in Control.Monad.Trans.State.Strict

Methods

lift :: Monad m => m a -> StateT s m a #

MonadTrans (WriterT w) # 
Instance details

Defined in Control.Monad.Trans.Writer.CPS

Methods

lift :: Monad m => m a -> WriterT w m a #

Monoid w => MonadTrans (WriterT w) # 
Instance details

Defined in Control.Monad.Trans.Writer.Lazy

Methods

lift :: Monad m => m a -> WriterT w m a #

Monoid w => MonadTrans (WriterT w) # 
Instance details

Defined in Control.Monad.Trans.Writer.Strict

Methods

lift :: Monad m => m a -> WriterT w m a #

MonadTrans (ConduitT i o) # 
Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

lift :: Monad m => m a -> ConduitT i o m a #

MonadTrans (ParsecT s u) # 
Instance details

Defined in Text.Parsec.Prim

Methods

lift :: Monad m => m a -> ParsecT s u m a #

MonadTrans (ContT r) # 
Instance details

Defined in Control.Monad.Trans.Cont

Methods

lift :: Monad m => m a -> ContT r m a #

MonadTrans (RWST r w s) # 
Instance details

Defined in Control.Monad.Trans.RWS.CPS

Methods

lift :: Monad m => m a -> RWST r w s m a #

Monoid w => MonadTrans (RWST r w s) # 
Instance details

Defined in Control.Monad.Trans.RWS.Lazy

Methods

lift :: Monad m => m a -> RWST r w s m a #

Monoid w => MonadTrans (RWST r w s) # 
Instance details

Defined in Control.Monad.Trans.RWS.Strict

Methods

lift :: Monad m => m a -> RWST r w s m a #

MonadTrans (Pipe l i o u) # 
Instance details

Defined in Data.Conduit.Internal.Pipe

Methods

lift :: Monad m => m a -> Pipe l i o u m a #

class Monad m => MonadIO (m :: Type -> Type) where #

Methods

liftIO :: IO a -> m a #

Instances

Instances details
MonadIO Q # 
Instance details

Defined in GHC.Internal.TH.Syntax

Methods

liftIO :: IO a -> Q a #

MonadIO IO # 
Instance details

Defined in GHC.Internal.Control.Monad.IO.Class

Methods

liftIO :: IO a -> IO a #

MonadIO Acquire # 
Instance details

Defined in Data.Acquire.Internal

Methods

liftIO :: IO a -> Acquire a #

MonadIO m => MonadIO (CatchT m) # 
Instance details

Defined in Control.Monad.Catch.Pure

Methods

liftIO :: IO a -> CatchT m a #

MonadIO m => MonadIO (LoggingT m) # 
Instance details

Defined in Control.Monad.Logger

Methods

liftIO :: IO a -> LoggingT m a #

MonadIO m => MonadIO (NoLoggingT m) # 
Instance details

Defined in Control.Monad.Logger

Methods

liftIO :: IO a -> NoLoggingT m a #

MonadIO m => MonadIO (WriterLoggingT m) # 
Instance details

Defined in Control.Monad.Logger

Methods

liftIO :: IO a -> WriterLoggingT m a #

MonadIO m => MonadIO (ResourceT m) # 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

liftIO :: IO a -> ResourceT m a #

Monad m => MonadIO (QuoteToQuasi m) # 
Instance details

Defined in Language.Haskell.TH.Syntax.Compat

Methods

liftIO :: IO a -> QuoteToQuasi m a #

MonadIO m => MonadIO (MaybeT m) # 
Instance details

Defined in Control.Monad.Trans.Maybe

Methods

liftIO :: IO a -> MaybeT m a #

MonadIO (HandlerFor site) Source # 
Instance details

Defined in Yesod.Core.Types

Methods

liftIO :: IO a -> HandlerFor site a #

MonadIO (WidgetFor site) Source # 
Instance details

Defined in Yesod.Core.Types

Methods

liftIO :: IO a -> WidgetFor site a #

(Monoid w, Functor m, MonadIO m) => MonadIO (AccumT w m) # 
Instance details

Defined in Control.Monad.Trans.Accum

Methods

liftIO :: IO a -> AccumT w m a #

MonadIO m => MonadIO (ExceptT e m) # 
Instance details

Defined in Control.Monad.Trans.Except

Methods

liftIO :: IO a -> ExceptT e m a #

MonadIO m => MonadIO (IdentityT m) # 
Instance details

Defined in Control.Monad.Trans.Identity

Methods

liftIO :: IO a -> IdentityT m a #

MonadIO m => MonadIO (ReaderT r m) # 
Instance details

Defined in Control.Monad.Trans.Reader

Methods

liftIO :: IO a -> ReaderT r m a #

MonadIO m => MonadIO (SelectT r m) # 
Instance details

Defined in Control.Monad.Trans.Select

Methods

liftIO :: IO a -> SelectT r m a #

MonadIO m => MonadIO (StateT s m) # 
Instance details

Defined in Control.Monad.Trans.State.Lazy

Methods

liftIO :: IO a -> StateT s m a #

MonadIO m => MonadIO (StateT s m) # 
Instance details

Defined in Control.Monad.Trans.State.Strict

Methods

liftIO :: IO a -> StateT s m a #

MonadIO m => MonadIO (WriterT w m) # 
Instance details

Defined in Control.Monad.Trans.Writer.CPS

Methods

liftIO :: IO a -> WriterT w m a #

(Monoid w, MonadIO m) => MonadIO (WriterT w m) # 
Instance details

Defined in Control.Monad.Trans.Writer.Lazy

Methods

liftIO :: IO a -> WriterT w m a #

(Monoid w, MonadIO m) => MonadIO (WriterT w m) # 
Instance details

Defined in Control.Monad.Trans.Writer.Strict

Methods

liftIO :: IO a -> WriterT w m a #

MonadIO (SubHandlerFor child master) Source # 
Instance details

Defined in Yesod.Core.Types

Methods

liftIO :: IO a -> SubHandlerFor child master a #

MonadIO m => MonadIO (ConduitT i o m) # 
Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

liftIO :: IO a -> ConduitT i o m a #

MonadIO m => MonadIO (ParsecT s u m) # 
Instance details

Defined in Text.Parsec.Prim

Methods

liftIO :: IO a -> ParsecT s u m a #

MonadIO m => MonadIO (ContT r m) # 
Instance details

Defined in Control.Monad.Trans.Cont

Methods

liftIO :: IO a -> ContT r m a #

MonadIO m => MonadIO (RWST r w s m) # 
Instance details

Defined in Control.Monad.Trans.RWS.CPS

Methods

liftIO :: IO a -> RWST r w s m a #

(Monoid w, MonadIO m) => MonadIO (RWST r w s m) # 
Instance details

Defined in Control.Monad.Trans.RWS.Lazy

Methods

liftIO :: IO a -> RWST r w s m a #

(Monoid w, MonadIO m) => MonadIO (RWST r w s m) # 
Instance details

Defined in Control.Monad.Trans.RWS.Strict

Methods

liftIO :: IO a -> RWST r w s m a #

MonadIO m => MonadIO (Pipe l i o u m) # 
Instance details

Defined in Data.Conduit.Internal.Pipe

Methods

liftIO :: IO a -> Pipe l i o u m a #

class MonadIO m => MonadUnliftIO (m :: Type -> Type) where #

Methods

withRunInIO :: ((forall a. m a -> IO a) -> IO b) -> m b #

Instances

Instances details
MonadUnliftIO IO # 
Instance details

Defined in Control.Monad.IO.Unlift

Methods

withRunInIO :: ((forall a. IO a -> IO a) -> IO b) -> IO b #

MonadUnliftIO m => MonadUnliftIO (LoggingT m) # 
Instance details

Defined in Control.Monad.Logger

Methods

withRunInIO :: ((forall a. LoggingT m a -> IO a) -> IO b) -> LoggingT m b #

MonadUnliftIO m => MonadUnliftIO (NoLoggingT m) # 
Instance details

Defined in Control.Monad.Logger

Methods

withRunInIO :: ((forall a. NoLoggingT m a -> IO a) -> IO b) -> NoLoggingT m b #

MonadUnliftIO m => MonadUnliftIO (ResourceT m) # 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

withRunInIO :: ((forall a. ResourceT m a -> IO a) -> IO b) -> ResourceT m b #

MonadUnliftIO (HandlerFor site) Source #

Since: 1.4.38

Instance details

Defined in Yesod.Core.Types

Methods

withRunInIO :: ((forall a. HandlerFor site a -> IO a) -> IO b) -> HandlerFor site b #

MonadUnliftIO (WidgetFor site) Source #

Since: 1.4.38

Instance details

Defined in Yesod.Core.Types

Methods

withRunInIO :: ((forall a. WidgetFor site a -> IO a) -> IO b) -> WidgetFor site b #

MonadUnliftIO m => MonadUnliftIO (IdentityT m) # 
Instance details

Defined in Control.Monad.IO.Unlift

Methods

withRunInIO :: ((forall a. IdentityT m a -> IO a) -> IO b) -> IdentityT m b #

MonadUnliftIO m => MonadUnliftIO (ReaderT r m) # 
Instance details

Defined in Control.Monad.IO.Unlift

Methods

withRunInIO :: ((forall a. ReaderT r m a -> IO a) -> IO b) -> ReaderT r m b #

MonadUnliftIO (SubHandlerFor child master) Source #

Since: 1.4.38

Instance details

Defined in Yesod.Core.Types

Methods

withRunInIO :: ((forall a. SubHandlerFor child master a -> IO a) -> IO b) -> SubHandlerFor child master b #

class MonadIO m => MonadResource (m :: Type -> Type) where #

Methods

liftResourceT :: ResourceT IO a -> m a #

Instances

Instances details
MonadResource m => MonadResource (LoggingT m) # 
Instance details

Defined in Control.Monad.Logger

Methods

liftResourceT :: ResourceT IO a -> LoggingT m a #

MonadResource m => MonadResource (NoLoggingT m) # 
Instance details

Defined in Control.Monad.Logger

Methods

liftResourceT :: ResourceT IO a -> NoLoggingT m a #

MonadIO m => MonadResource (ResourceT m) # 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

liftResourceT :: ResourceT IO a -> ResourceT m a #

MonadResource m => MonadResource (MaybeT m) # 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

liftResourceT :: ResourceT IO a -> MaybeT m a #

MonadResource (HandlerFor site) Source # 
Instance details

Defined in Yesod.Core.Types

Methods

liftResourceT :: ResourceT IO a -> HandlerFor site a #

MonadResource (WidgetFor site) Source # 
Instance details

Defined in Yesod.Core.Types

Methods

liftResourceT :: ResourceT IO a -> WidgetFor site a #

MonadResource m => MonadResource (ExceptT e m) # 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

liftResourceT :: ResourceT IO a -> ExceptT e m a #

MonadResource m => MonadResource (IdentityT m) # 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

liftResourceT :: ResourceT IO a -> IdentityT m a #

MonadResource m => MonadResource (ReaderT r m) # 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

liftResourceT :: ResourceT IO a -> ReaderT r m a #

MonadResource m => MonadResource (StateT s m) # 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

liftResourceT :: ResourceT IO a -> StateT s m a #

MonadResource m => MonadResource (StateT s m) # 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

liftResourceT :: ResourceT IO a -> StateT s m a #

(Monoid w, MonadResource m) => MonadResource (WriterT w m) # 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

liftResourceT :: ResourceT IO a -> WriterT w m a #

(Monoid w, MonadResource m) => MonadResource (WriterT w m) # 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

liftResourceT :: ResourceT IO a -> WriterT w m a #

MonadResource (SubHandlerFor child master) Source # 
Instance details

Defined in Yesod.Core.Types

Methods

liftResourceT :: ResourceT IO a -> SubHandlerFor child master a #

MonadResource m => MonadResource (ConduitT i o m) # 
Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

liftResourceT :: ResourceT IO a -> ConduitT i o m a #

MonadResource m => MonadResource (ContT r m) # 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

liftResourceT :: ResourceT IO a -> ContT r m a #

(Monoid w, MonadResource m) => MonadResource (RWST r w s m) # 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

liftResourceT :: ResourceT IO a -> RWST r w s m a #

(Monoid w, MonadResource m) => MonadResource (RWST r w s m) # 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

liftResourceT :: ResourceT IO a -> RWST r w s m a #

MonadResource m => MonadResource (Pipe l i o u m) # 
Instance details

Defined in Data.Conduit.Internal.Pipe

Methods

liftResourceT :: ResourceT IO a -> Pipe l i o u m a #

class Monad m => MonadLogger (m :: Type -> Type) #

Instances

Instances details
MonadIO m => MonadLogger (LoggingT m) # 
Instance details

Defined in Control.Monad.Logger

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> LoggingT m ()

Monad m => MonadLogger (NoLoggingT m) # 
Instance details

Defined in Control.Monad.Logger

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> NoLoggingT m ()

Monad m => MonadLogger (WriterLoggingT m) # 
Instance details

Defined in Control.Monad.Logger

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> WriterLoggingT m ()

MonadLogger m => MonadLogger (ResourceT m) # 
Instance details

Defined in Control.Monad.Logger

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> ResourceT m ()

MonadLogger m => MonadLogger (MaybeT m) # 
Instance details

Defined in Control.Monad.Logger

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> MaybeT m ()

MonadLogger (HandlerFor site) Source # 
Instance details

Defined in Yesod.Core.Types

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> HandlerFor site ()

MonadLogger (WidgetFor site) Source # 
Instance details

Defined in Yesod.Core.Types

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> WidgetFor site ()

MonadLogger m => MonadLogger (ExceptT e m) # 
Instance details

Defined in Control.Monad.Logger

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> ExceptT e m ()

MonadLogger m => MonadLogger (IdentityT m) # 
Instance details

Defined in Control.Monad.Logger

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> IdentityT m ()

MonadLogger m => MonadLogger (ReaderT r m) # 
Instance details

Defined in Control.Monad.Logger

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> ReaderT r m ()

MonadLogger m => MonadLogger (StateT s m) # 
Instance details

Defined in Control.Monad.Logger

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> StateT s m ()

MonadLogger m => MonadLogger (StateT s m) # 
Instance details

Defined in Control.Monad.Logger

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> StateT s m ()

(MonadLogger m, Monoid w) => MonadLogger (WriterT w m) # 
Instance details

Defined in Control.Monad.Logger

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> WriterT w m ()

(MonadLogger m, Monoid w) => MonadLogger (WriterT w m) # 
Instance details

Defined in Control.Monad.Logger

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> WriterT w m ()

MonadLogger (SubHandlerFor child master) Source # 
Instance details

Defined in Yesod.Core.Types

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> SubHandlerFor child master ()

MonadLogger m => MonadLogger (ConduitM i o m) # 
Instance details

Defined in Control.Monad.Logger

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> ConduitM i o m ()

MonadLogger m => MonadLogger (ContT r m) # 
Instance details

Defined in Control.Monad.Logger

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> ContT r m ()

(MonadLogger m, Monoid w) => MonadLogger (RWST r w s m) # 
Instance details

Defined in Control.Monad.Logger

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> RWST r w s m ()

(MonadLogger m, Monoid w) => MonadLogger (RWST r w s m) # 
Instance details

Defined in Control.Monad.Logger

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> RWST r w s m ()

MonadLogger m => MonadLogger (Pipe l i o u m) # 
Instance details

Defined in Control.Monad.Logger

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> Pipe l i o u m ()

Commonly referenced functions/datatypes

type Application = Request -> (Response -> IO ResponseReceived) -> IO ResponseReceived #

Utilities

showIntegral :: Integral a => a -> String Source #

readIntegral :: Num a => String -> Maybe a Source #

Shakespeare

Hamlet

hamlet :: QuasiQuoter #

shamlet :: QuasiQuoter #

xhamlet :: QuasiQuoter #

type HtmlUrl url = Render url -> Html #

Julius

julius :: QuasiQuoter #

type JavascriptUrl url = (url -> [(Text, Text)] -> Text) -> Javascript #

renderJavascriptUrl :: (url -> [(Text, Text)] -> Text) -> JavascriptUrl url -> Text #

Cassius/Lucius

cassius :: QuasiQuoter #

lucius :: QuasiQuoter #

type CssUrl url = (url -> [(Text, Text)] -> Text) -> Css #

renderCssUrl :: (url -> [(Text, Text)] -> Text) -> CssUrl url -> Text #