-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | Creation of type-safe, RESTful web applications.
--   
--   API docs and the README are available at
--   http://www.stackage.org/package/yesod-core
@package yesod-core
@version 1.6.28.1

module Yesod.Core.Types
type SessionMap = Map Text ByteString
type SaveSession = SessionMap -> IO [Header]
newtype SessionBackend
SessionBackend :: (Request -> IO (SessionMap, SaveSession)) -> SessionBackend

-- | Return the session data and a function to save the session
[sbLoadSession] :: SessionBackend -> Request -> IO (SessionMap, SaveSession)
data SessionCookie
SessionCookie :: !Either UTCTime ByteString -> !ByteString -> !SessionMap -> SessionCookie
data ClientSessionDateCache
ClientSessionDateCache :: !UTCTime -> !UTCTime -> !ByteString -> ClientSessionDateCache
[csdcNow] :: ClientSessionDateCache -> !UTCTime
[csdcExpires] :: ClientSessionDateCache -> !UTCTime
[csdcExpiresSerialized] :: ClientSessionDateCache -> !ByteString

-- | The parsed request information. This type augments the standard WAI
--   Request with additional information.
data YesodRequest
YesodRequest :: ![(Text, Text)] -> ![(Text, Text)] -> !Request -> ![Text] -> !Maybe Text -> !SessionMap -> ![ContentType] -> YesodRequest

-- | Same as queryString, but decoded to Text.
[reqGetParams] :: YesodRequest -> ![(Text, Text)]
[reqCookies] :: YesodRequest -> ![(Text, Text)]
[reqWaiRequest] :: YesodRequest -> !Request

-- | Languages which the client supports. This is an ordered list by
--   preference.
[reqLangs] :: YesodRequest -> ![Text]

-- | A random, session-specific token used to prevent CSRF attacks.
[reqToken] :: YesodRequest -> !Maybe Text

-- | Initial session sent from the client.
--   
--   Since 1.2.0
[reqSession] :: YesodRequest -> !SessionMap

-- | An ordered list of the accepted content types.
--   
--   Since 1.2.0
[reqAccept] :: YesodRequest -> ![ContentType]

-- | An augmented WAI Response. This can either be a standard
--   Response, or a higher-level data structure which Yesod will
--   turn into a Response.
data YesodResponse
YRWai :: !Response -> YesodResponse
YRWaiApp :: !Application -> YesodResponse
YRPlain :: !Status -> ![Header] -> !ContentType -> !Content -> !SessionMap -> YesodResponse

-- | A tuple containing both the POST parameters and submitted files.
type RequestBodyContents = ([(Text, Text)], [(Text, FileInfo)])
data FileInfo
FileInfo :: !Text -> !Text -> !ConduitT () ByteString (ResourceT IO) () -> !FilePath -> IO () -> FileInfo
[fileName] :: FileInfo -> !Text
[fileContentType] :: FileInfo -> !Text
[fileSourceRaw] :: FileInfo -> !ConduitT () ByteString (ResourceT IO) ()
[fileMove] :: FileInfo -> !FilePath -> IO ()
data FileUpload
FileUploadMemory :: !BackEnd ByteString -> FileUpload
FileUploadDisk :: !InternalState -> BackEnd FilePath -> FileUpload
FileUploadSource :: !BackEnd (ConduitT () ByteString (ResourceT IO) ()) -> FileUpload

-- | 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.
data Approot master

-- | No application root.
ApprootRelative :: Approot master
ApprootStatic :: !Text -> Approot master
ApprootMaster :: !master -> Text -> Approot master
ApprootRequest :: !master -> Request -> Text -> Approot master
type ResolvedApproot = Text
data AuthResult
Authorized :: AuthResult
AuthenticationRequired :: AuthResult
Unauthorized :: !Text -> AuthResult
data ScriptLoadPosition master
BottomOfBody :: ScriptLoadPosition master
BottomOfHeadBlocking :: ScriptLoadPosition master
BottomOfHeadAsync :: !BottomOfHeadAsync master -> ScriptLoadPosition master
type BottomOfHeadAsync master = [Text] -> Maybe HtmlUrl Route master -> HtmlUrl Route master
type Texts = [Text]

-- | Wrap up a normal WAI application as a Yesod subsite. Ignore parent
--   site's middleware and isAuthorized.
newtype WaiSubsite
WaiSubsite :: Application -> WaiSubsite
[runWaiSubsite] :: WaiSubsite -> Application

-- | Like WaiSubsite, but applies parent site's middleware and
--   isAuthorized.
newtype WaiSubsiteWithAuth
WaiSubsiteWithAuth :: Application -> WaiSubsiteWithAuth
[runWaiSubsiteWithAuth] :: WaiSubsiteWithAuth -> Application
data RunHandlerEnv child site
RunHandlerEnv :: !Route site -> [(Text, Text)] -> Text -> !Maybe (Route child) -> !Route child -> Route site -> !site -> !child -> !RequestBodyLength -> FileUpload -> !Loc -> LogSource -> LogLevel -> LogStr -> IO () -> !ErrorResponse -> YesodApp -> !Text -> !forall a (m :: Type -> Type). MonadUnliftIO m => m a -> (SomeException -> m a) -> m a -> RunHandlerEnv child site
[rheRender] :: RunHandlerEnv child site -> !Route site -> [(Text, Text)] -> Text
[rheRoute] :: RunHandlerEnv child site -> !Maybe (Route child)
[rheRouteToMaster] :: RunHandlerEnv child site -> !Route child -> Route site
[rheSite] :: RunHandlerEnv child site -> !site
[rheChild] :: RunHandlerEnv child site -> !child
[rheUpload] :: RunHandlerEnv child site -> !RequestBodyLength -> FileUpload
[rheLog] :: RunHandlerEnv child site -> !Loc -> LogSource -> LogLevel -> LogStr -> IO ()

-- | How to respond when an error is thrown internally.
--   
--   Since 1.2.0
[rheOnError] :: RunHandlerEnv child site -> !ErrorResponse -> YesodApp
[rheMaxExpires] :: RunHandlerEnv child site -> !Text

-- | catch function for rendering 500 pages on exceptions. by default this
--   is catch from unliftio (rethrows all async exceptions).
[rheCatchHandlerExceptions] :: RunHandlerEnv child site -> !forall a (m :: Type -> Type). MonadUnliftIO m => m a -> (SomeException -> m a) -> m a
data HandlerData child site
HandlerData :: !YesodRequest -> !RunHandlerEnv child site -> !IORef GHState -> !InternalState -> HandlerData child site
[handlerRequest] :: HandlerData child site -> !YesodRequest
[handlerEnv] :: HandlerData child site -> !RunHandlerEnv child site
[handlerState] :: HandlerData child site -> !IORef GHState
[handlerResource] :: HandlerData child site -> !InternalState
data YesodRunnerEnv site
YesodRunnerEnv :: !Logger -> !site -> !Maybe SessionBackend -> !IO Int -> !IO Text -> YesodRunnerEnv site
[yreLogger] :: YesodRunnerEnv site -> !Logger
[yreSite] :: YesodRunnerEnv site -> !site
[yreSessionBackend] :: YesodRunnerEnv site -> !Maybe SessionBackend

-- | Generate a random number uniformly distributed in the full range of
--   Int.
--   
--   Note: Before 1.6.20, the default value generates pseudo-random number
--   in an unspecified range. The range size may not be a power of 2. Since
--   1.6.20, the default value uses a secure entropy source and generates
--   in the full range of Int.
[yreGen] :: YesodRunnerEnv site -> !IO Int
[yreGetMaxExpires] :: YesodRunnerEnv site -> !IO Text
data YesodSubRunnerEnv sub parent
YesodSubRunnerEnv :: !ParentRunner parent -> !parent -> sub -> !Route sub -> Route parent -> !YesodRunnerEnv parent -> YesodSubRunnerEnv sub parent
[ysreParentRunner] :: YesodSubRunnerEnv sub parent -> !ParentRunner parent
[ysreGetSub] :: YesodSubRunnerEnv sub parent -> !parent -> sub
[ysreToParentRoute] :: YesodSubRunnerEnv sub parent -> !Route sub -> Route parent
[ysreParentEnv] :: YesodSubRunnerEnv sub parent -> !YesodRunnerEnv parent
type ParentRunner parent = HandlerFor parent TypedContent -> YesodRunnerEnv parent -> Maybe Route parent -> Application

-- | A generic handler monad, which can have a different subsite and master
--   site. We define a newtype for better error message.
newtype HandlerFor site a
HandlerFor :: (HandlerData site site -> IO a) -> HandlerFor site a
[unHandlerFor] :: HandlerFor site a -> HandlerData site site -> IO a
data GHState
GHState :: !SessionMap -> !Maybe RequestBodyContents -> !Int -> !TypeMap -> !KeyedTypeMap -> !Endo [Header] -> GHState
[ghsSession] :: GHState -> !SessionMap
[ghsRBC] :: GHState -> !Maybe RequestBodyContents
[ghsIdent] :: GHState -> !Int
[ghsCache] :: GHState -> !TypeMap
[ghsCacheBy] :: GHState -> !KeyedTypeMap
[ghsHeaders] :: GHState -> !Endo [Header]

-- | 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 HandlerFor monad and template haskell code
--   should hide it away.
type YesodApp = YesodRequest -> ResourceT IO YesodResponse

-- | 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.
newtype WidgetFor site a
WidgetFor :: (WidgetData site -> IO a) -> WidgetFor site a
[unWidgetFor] :: WidgetFor site a -> WidgetData site -> IO a
data WidgetData site
WidgetData :: {-# UNPACK #-} !IORef (GWData (Route site)) -> {-# UNPACK #-} !HandlerData site site -> WidgetData site
[wdRef] :: WidgetData site -> {-# UNPACK #-} !IORef (GWData (Route site))
[wdHandler] :: WidgetData site -> {-# UNPACK #-} !HandlerData site site
tellWidget :: GWData (Route site) -> WidgetFor site ()
type RY master = Route master -> [(Text, Text)] -> Text

-- | Newtype wrapper allowing injection of arbitrary content into CSS.
--   
--   Usage:
--   
--   
--   toWidget $ CssBuilder "p { color: red }"
--   
--   
--   Since: 1.1.3
newtype CssBuilder
CssBuilder :: Builder -> CssBuilder
[unCssBuilder] :: CssBuilder -> Builder

-- | 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
--   
data PageContent url
PageContent :: !Html -> !Maybe Text -> !HtmlUrl url -> !HtmlUrl url -> PageContent url
[pageTitle] :: PageContent url -> !Html
[pageDescription] :: PageContent url -> !Maybe Text
[pageHead] :: PageContent url -> !HtmlUrl url
[pageBody] :: PageContent url -> !HtmlUrl url
data Content

-- | The content and optional content length.
ContentBuilder :: !Builder -> !Maybe Int -> Content
ContentSource :: !ConduitT () (Flush Builder) (ResourceT IO) () -> Content
ContentFile :: !FilePath -> !Maybe FilePart -> Content
ContentDontEvaluate :: !Content -> Content
data TypedContent
TypedContent :: !ContentType -> !Content -> TypedContent

-- | Deprecated: Please use Html instead
type RepHtml = Html
newtype RepJson
RepJson :: Content -> RepJson
newtype RepPlain
RepPlain :: Content -> RepPlain
newtype RepXml
RepXml :: Content -> RepXml
type ContentType = ByteString

-- | Wrapper around types so that Handlers can return a domain type, even
--   when the data will eventually be encoded as JSON. Example usage in a
--   type signature:
--   
--   
--   postSignupR :: Handler (JSONResponse CreateUserResponse)
--   
--   
--   And in the implementation:
--   
--   
--   return $ JSONResponse $ CreateUserResponse userId
--   
data JSONResponse a
[JSONResponse] :: forall a. ToJSON a => a -> JSONResponse a

-- | Prevents a response body from being fully evaluated before sending the
--   request.
--   
--   Since 1.1.0
newtype DontFullyEvaluate a
DontFullyEvaluate :: a -> DontFullyEvaluate a
[unDontFullyEvaluate] :: DontFullyEvaluate a -> a

-- | Responses to indicate some form of an error occurred.
data ErrorResponse

-- | 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.
NotFound :: ErrorResponse

-- | 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.
InternalError :: !Text -> ErrorResponse

-- | 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.
InvalidArgs :: ![Text] -> ErrorResponse

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

-- | Indicates the user doesn't have permission to access the requested
--   resource. This is thrown when isAuthorized returns
--   Unauthorized. HTTP code: 403.
PermissionDenied :: !Text -> ErrorResponse

-- | 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.
BadMethod :: !Method -> ErrorResponse

-- | Headers to be added to a Result.
data Header
AddCookie :: !SetCookie -> Header

-- | name and path
DeleteCookie :: !ByteString -> !ByteString -> Header

-- | key and value
Header :: !CI ByteString -> !ByteString -> Header
data Location url
Local :: !url -> Location url
Remote :: !Text -> Location url

-- | A diff list that does not directly enforce uniqueness. When creating a
--   widget Yesod will use nub to make it unique.
newtype UniqueList x
UniqueList :: ([x] -> [x]) -> UniqueList x
data Script url
Script :: !Location url -> ![(Text, Text)] -> Script url
[scriptLocation] :: Script url -> !Location url
[scriptAttributes] :: Script url -> ![(Text, Text)]
data Stylesheet url
Stylesheet :: !Location url -> ![(Text, Text)] -> Stylesheet url
[styleLocation] :: Stylesheet url -> !Location url
[styleAttributes] :: Stylesheet url -> ![(Text, Text)]
newtype Title
Title :: Html -> Title
[unTitle] :: Title -> Html
newtype Description
Description :: Text -> Description
[unDescription] :: Description -> Text
newtype Head url
Head :: HtmlUrl url -> Head url
newtype Body url
Body :: HtmlUrl url -> Body url
type CssBuilderUrl a = a -> [(Text, Text)] -> Text -> Builder
data GWData a
GWData :: !Body a -> !Last Title -> !Last Description -> !UniqueList (Script a) -> !UniqueList (Stylesheet a) -> !Map (Maybe Text) (CssBuilderUrl a) -> !Maybe (JavascriptUrl a) -> !Head a -> GWData a
[gwdBody] :: GWData a -> !Body a
[gwdTitle] :: GWData a -> !Last Title
[gwdDescription] :: GWData a -> !Last Description
[gwdScripts] :: GWData a -> !UniqueList (Script a)
[gwdStylesheets] :: GWData a -> !UniqueList (Stylesheet a)
[gwdCss] :: GWData a -> !Map (Maybe Text) (CssBuilderUrl a)
[gwdJavascript] :: GWData a -> !Maybe (JavascriptUrl a)
[gwdHead] :: GWData a -> !Head a
data HandlerContents
HCContent :: !Status -> !TypedContent -> HandlerContents
HCError :: !ErrorResponse -> HandlerContents
HCSendFile :: !ContentType -> !FilePath -> !Maybe FilePart -> HandlerContents
HCRedirect :: !Status -> !Text -> HandlerContents
HCCreated :: !Text -> HandlerContents
HCWai :: !Response -> HandlerContents
HCWaiApp :: !Application -> HandlerContents
data Logger
Logger :: !LoggerSet -> !DateCacheGetter -> Logger
[loggerSet] :: Logger -> !LoggerSet
[loggerDate] :: Logger -> !DateCacheGetter
loggerPutStr :: Logger -> LogStr -> IO ()

-- | A handler monad for subsite
newtype SubHandlerFor sub master a
SubHandlerFor :: (HandlerData sub master -> IO a) -> SubHandlerFor sub master a
[unSubHandlerFor] :: SubHandlerFor sub master a -> HandlerData sub master -> IO a
instance GHC.Internal.Base.Applicative (Yesod.Core.Types.HandlerFor site)
instance GHC.Internal.Base.Applicative (Yesod.Core.Types.SubHandlerFor child master)
instance GHC.Internal.Base.Applicative (Yesod.Core.Types.WidgetFor site)
instance GHC.Classes.Eq Yesod.Core.Types.AuthResult
instance GHC.Classes.Eq Yesod.Core.Types.ClientSessionDateCache
instance GHC.Classes.Eq Yesod.Core.Types.ErrorResponse
instance GHC.Classes.Eq Yesod.Core.Types.Header
instance GHC.Classes.Eq url => GHC.Classes.Eq (Yesod.Core.Types.Location url)
instance GHC.Classes.Eq (Yesod.Routes.Class.Route Yesod.Core.Types.WaiSubsite)
instance GHC.Classes.Eq (Yesod.Routes.Class.Route Yesod.Core.Types.WaiSubsiteWithAuth)
instance GHC.Classes.Eq url => GHC.Classes.Eq (Yesod.Core.Types.Script url)
instance GHC.Classes.Eq url => GHC.Classes.Eq (Yesod.Core.Types.Stylesheet url)
instance GHC.Internal.Exception.Type.Exception Yesod.Core.Types.HandlerContents
instance GHC.Internal.Base.Functor (Yesod.Core.Types.HandlerFor site)
instance GHC.Internal.Base.Functor (Yesod.Core.Types.SubHandlerFor sub master)
instance GHC.Internal.Base.Functor (Yesod.Core.Types.WidgetFor site)
instance GHC.Internal.Generics.Generic Yesod.Core.Types.ErrorResponse
instance GHC.Internal.Data.String.IsString Yesod.Core.Types.Content
instance (a GHC.Types.~ ()) => GHC.Internal.Data.String.IsString (Yesod.Core.Types.WidgetFor site a)
instance Control.Monad.IO.Class.MonadIO (Yesod.Core.Types.HandlerFor site)
instance Control.Monad.IO.Class.MonadIO (Yesod.Core.Types.SubHandlerFor child master)
instance Control.Monad.IO.Class.MonadIO (Yesod.Core.Types.WidgetFor site)
instance Control.Monad.Logger.MonadLoggerIO (Yesod.Core.Types.HandlerFor site)
instance Control.Monad.Logger.MonadLoggerIO (Yesod.Core.Types.SubHandlerFor child master)
instance Control.Monad.Logger.MonadLoggerIO (Yesod.Core.Types.WidgetFor site)
instance Control.Monad.Logger.MonadLogger (Yesod.Core.Types.HandlerFor site)
instance Control.Monad.Logger.MonadLogger (Yesod.Core.Types.SubHandlerFor child master)
instance Control.Monad.Logger.MonadLogger (Yesod.Core.Types.WidgetFor site)
instance Control.Monad.Reader.Class.MonadReader (Yesod.Core.Types.HandlerData site site) (Yesod.Core.Types.HandlerFor site)
instance Control.Monad.Reader.Class.MonadReader (Yesod.Core.Types.HandlerData child master) (Yesod.Core.Types.SubHandlerFor child master)
instance Control.Monad.Reader.Class.MonadReader (Yesod.Core.Types.WidgetData site) (Yesod.Core.Types.WidgetFor site)
instance Control.Monad.Trans.Resource.Internal.MonadResource (Yesod.Core.Types.HandlerFor site)
instance Control.Monad.Trans.Resource.Internal.MonadResource (Yesod.Core.Types.SubHandlerFor child master)
instance Control.Monad.Trans.Resource.Internal.MonadResource (Yesod.Core.Types.WidgetFor site)
instance Control.Monad.Catch.MonadThrow (Yesod.Core.Types.HandlerFor site)
instance Control.Monad.Catch.MonadThrow (Yesod.Core.Types.SubHandlerFor child master)
instance Control.Monad.Catch.MonadThrow (Yesod.Core.Types.WidgetFor site)
instance Control.Monad.IO.Unlift.MonadUnliftIO (Yesod.Core.Types.HandlerFor site)
instance Control.Monad.IO.Unlift.MonadUnliftIO (Yesod.Core.Types.SubHandlerFor child master)
instance Control.Monad.IO.Unlift.MonadUnliftIO (Yesod.Core.Types.WidgetFor site)
instance GHC.Internal.Base.Monad (Yesod.Core.Types.HandlerFor site)
instance GHC.Internal.Base.Monad (Yesod.Core.Types.SubHandlerFor child master)
instance GHC.Internal.Base.Monad (Yesod.Core.Types.WidgetFor site)
instance GHC.Internal.Base.Monoid (Yesod.Core.Types.Body url)
instance GHC.Internal.Base.Monoid (Yesod.Core.Types.GWData a)
instance GHC.Internal.Base.Monoid (Yesod.Core.Types.Head url)
instance GHC.Internal.Base.Monoid (Yesod.Core.Types.UniqueList x)
instance (a GHC.Types.~ ()) => GHC.Internal.Base.Monoid (Yesod.Core.Types.WidgetFor site a)
instance Control.DeepSeq.NFData Yesod.Core.Types.ErrorResponse
instance Control.DeepSeq.NFData Yesod.Core.Types.Header
instance GHC.Classes.Ord (Yesod.Routes.Class.Route Yesod.Core.Types.WaiSubsite)
instance GHC.Classes.Ord (Yesod.Routes.Class.Route Yesod.Core.Types.WaiSubsiteWithAuth)
instance Yesod.Routes.Class.ParseRoute Yesod.Core.Types.WaiSubsite
instance Yesod.Routes.Class.ParseRoute Yesod.Core.Types.WaiSubsiteWithAuth
instance Control.Monad.Primitive.PrimMonad (Yesod.Core.Types.HandlerFor site)
instance Control.Monad.Primitive.PrimMonad (Yesod.Core.Types.WidgetFor site)
instance GHC.Internal.Read.Read Yesod.Core.Types.AuthResult
instance GHC.Internal.Read.Read (Yesod.Routes.Class.Route Yesod.Core.Types.WaiSubsite)
instance GHC.Internal.Read.Read (Yesod.Routes.Class.Route Yesod.Core.Types.WaiSubsiteWithAuth)
instance GHC.Internal.Read.Read Yesod.Core.Types.SessionCookie
instance Yesod.Routes.Class.RenderRoute Yesod.Core.Types.WaiSubsite
instance Yesod.Routes.Class.RenderRoute Yesod.Core.Types.WaiSubsiteWithAuth
instance GHC.Internal.Base.Semigroup (Yesod.Core.Types.Body url)
instance GHC.Internal.Base.Semigroup (Yesod.Core.Types.GWData a)
instance GHC.Internal.Base.Semigroup (Yesod.Core.Types.Head url)
instance GHC.Internal.Base.Semigroup (Yesod.Core.Types.UniqueList x)
instance (a GHC.Types.~ ()) => GHC.Internal.Base.Semigroup (Yesod.Core.Types.WidgetFor site a)
instance Data.Serialize.Serialize Yesod.Core.Types.SessionCookie
instance GHC.Internal.Show.Show Yesod.Core.Types.AuthResult
instance GHC.Internal.Show.Show Yesod.Core.Types.ClientSessionDateCache
instance GHC.Internal.Show.Show Yesod.Core.Types.ErrorResponse
instance GHC.Internal.Show.Show Yesod.Core.Types.HandlerContents
instance GHC.Internal.Show.Show Yesod.Core.Types.Header
instance GHC.Internal.Show.Show url => GHC.Internal.Show.Show (Yesod.Core.Types.Location url)
instance GHC.Internal.Show.Show (Yesod.Routes.Class.Route Yesod.Core.Types.WaiSubsite)
instance GHC.Internal.Show.Show (Yesod.Routes.Class.Route Yesod.Core.Types.WaiSubsiteWithAuth)
instance GHC.Internal.Show.Show url => GHC.Internal.Show.Show (Yesod.Core.Types.Script url)
instance GHC.Internal.Show.Show Yesod.Core.Types.SessionCookie
instance GHC.Internal.Show.Show url => GHC.Internal.Show.Show (Yesod.Core.Types.Stylesheet url)

module Yesod.Core.Content
data Content

-- | The content and optional content length.
ContentBuilder :: !Builder -> !Maybe Int -> Content
ContentSource :: !ConduitT () (Flush Builder) (ResourceT IO) () -> Content
ContentFile :: !FilePath -> !Maybe FilePart -> Content
ContentDontEvaluate :: !Content -> Content

-- | Zero-length enumerator.
emptyContent :: Content

-- | Anything which can be converted into Content. Most of the time,
--   you will want to use the ContentBuilder constructor. An easier
--   approach will be to use a pre-defined toContent function, such
--   as converting your data into a lazy bytestring and then calling
--   toContent on that.
--   
--   Please note that the built-in instances for lazy data structures
--   (String, lazy ByteString, lazy Text and
--   Html) will not automatically include the content length for the
--   ContentBuilder constructor.
class ToContent a
toContent :: ToContent a => a -> Content

-- | A class for all data which can be sent in a streaming response. Note
--   that for textual data, instances must use UTF-8 encoding.
--   
--   Since 1.2.0
class ToFlushBuilder a
toFlushBuilder :: ToFlushBuilder a => a -> Flush Builder
type ContentType = ByteString
typeHtml :: ContentType
typePlain :: ContentType
typeJson :: ContentType
typeXml :: ContentType
typeAtom :: ContentType
typeRss :: ContentType
typeJpeg :: ContentType
typePng :: ContentType
typeGif :: ContentType
typeSvg :: ContentType
typeJavascript :: ContentType
typeCss :: ContentType
typeFlv :: ContentType
typeOgv :: ContentType
typeOctet :: ContentType

-- | Removes "extra" information at the end of a content type string. In
--   particular, removes everything after the semicolon, if present.
--   
--   For example, "text/html; charset=utf-8" is commonly used to specify
--   the character encoding for HTML data. This function would return
--   "text/html".
simpleContentType :: ContentType -> ContentType

-- | Give just the media types as a pair.
--   
--   For example, "text/html; charset=utf-8" returns ("text", "html")
contentTypeTypes :: ContentType -> (ByteString, ByteString)

-- | Prevents a response body from being fully evaluated before sending the
--   request.
--   
--   Since 1.1.0
newtype DontFullyEvaluate a
DontFullyEvaluate :: a -> DontFullyEvaluate a
[unDontFullyEvaluate] :: DontFullyEvaluate a -> a
data TypedContent
TypedContent :: !ContentType -> !Content -> TypedContent

-- | Any type which can be converted to TypedContent.
--   
--   Since 1.2.0
class ToContent a => ToTypedContent a
toTypedContent :: ToTypedContent a => a -> TypedContent
class ToTypedContent a => HasContentType a
getContentType :: (HasContentType a, Monad m) => m a -> ContentType

-- | Deprecated: Please use Html instead
type RepHtml = Html
newtype RepJson
RepJson :: Content -> RepJson
newtype RepPlain
RepPlain :: Content -> RepPlain
newtype RepXml
RepXml :: Content -> RepXml
repJson :: ToContent a => a -> RepJson
repPlain :: ToContent a => a -> RepPlain
repXml :: ToContent a => a -> RepXml
instance Yesod.Core.Content.HasContentType Text.Internal.Css.Css
instance Yesod.Core.Content.HasContentType a => Yesod.Core.Content.HasContentType (Yesod.Core.Types.DontFullyEvaluate a)
instance Yesod.Core.Content.HasContentType Data.Aeson.Encoding.Internal.Encoding
instance Yesod.Core.Content.HasContentType (Yesod.Core.Types.JSONResponse a)
instance Yesod.Core.Content.HasContentType Text.Julius.Javascript
instance Yesod.Core.Content.HasContentType Text.Blaze.Html.Html
instance Yesod.Core.Content.HasContentType Yesod.Core.Types.RepJson
instance Yesod.Core.Content.HasContentType Yesod.Core.Types.RepPlain
instance Yesod.Core.Content.HasContentType Yesod.Core.Types.RepXml
instance Yesod.Core.Content.HasContentType Data.Text.Internal.Text
instance Yesod.Core.Content.HasContentType Data.Text.Internal.Lazy.Text
instance Yesod.Core.Content.HasContentType Data.Aeson.Types.Internal.Value
instance Yesod.Core.Content.ToContent Data.ByteString.Builder.Internal.Builder
instance Yesod.Core.Content.ToContent Data.ByteString.Lazy.Internal.ByteString
instance Yesod.Core.Content.ToContent Data.ByteString.Internal.Type.ByteString
instance Yesod.Core.Content.ToFlushBuilder builder => Yesod.Core.Content.ToContent (Data.Conduit.Internal.Conduit.ConduitT () builder (Control.Monad.Trans.Resource.Internal.ResourceT GHC.Types.IO) ())
instance Yesod.Core.Content.ToContent Yesod.Core.Types.Content
instance Yesod.Core.Content.ToContent Text.Internal.Css.Css
instance Yesod.Core.Content.ToContent a => Yesod.Core.Content.ToContent (Yesod.Core.Types.DontFullyEvaluate a)
instance Yesod.Core.Content.ToContent Data.Aeson.Encoding.Internal.Encoding
instance Yesod.Core.Content.ToContent (Yesod.Core.Types.JSONResponse a)
instance Yesod.Core.Content.ToContent Text.Julius.Javascript
instance Yesod.Core.Content.ToContent GHC.Internal.Base.String
instance Yesod.Core.Content.ToContent Text.Blaze.Html.Html
instance Yesod.Core.Content.ToFlushBuilder builder => Yesod.Core.Content.ToContent (Data.Conduit.Internal.Pipe.Pipe () () builder () (Control.Monad.Trans.Resource.Internal.ResourceT GHC.Types.IO) ())
instance Yesod.Core.Content.ToContent Yesod.Core.Types.RepJson
instance Yesod.Core.Content.ToContent Yesod.Core.Types.RepPlain
instance Yesod.Core.Content.ToContent Yesod.Core.Types.RepXml
instance Yesod.Core.Content.ToFlushBuilder builder => Yesod.Core.Content.ToContent (Data.Conduit.Internal.Conduit.SealedConduitT () builder (Control.Monad.Trans.Resource.Internal.ResourceT GHC.Types.IO) ())
instance Yesod.Core.Content.ToContent Data.Text.Internal.Lazy.Text
instance Yesod.Core.Content.ToContent Data.Text.Internal.Text
instance Yesod.Core.Content.ToContent (Yesod.Core.Types.ContentType, Yesod.Core.Types.Content)
instance Yesod.Core.Content.ToContent Yesod.Core.Types.TypedContent
instance Yesod.Core.Content.ToContent ()
instance Yesod.Core.Content.ToContent Data.Aeson.Types.Internal.Value
instance Yesod.Core.Content.ToContent GHC.Internal.Base.Void
instance Yesod.Core.Content.ToFlushBuilder Data.ByteString.Builder.Internal.Builder
instance Yesod.Core.Content.ToFlushBuilder Data.ByteString.Lazy.Internal.ByteString
instance Yesod.Core.Content.ToFlushBuilder Data.ByteString.Internal.Type.ByteString
instance Yesod.Core.Content.ToFlushBuilder (Data.Conduit.Internal.Conduit.Flush Data.ByteString.Builder.Internal.Builder)
instance Yesod.Core.Content.ToFlushBuilder (Data.Conduit.Internal.Conduit.Flush Data.ByteString.Internal.Type.ByteString)
instance Yesod.Core.Content.ToFlushBuilder (Data.Conduit.Internal.Conduit.Flush Data.ByteString.Lazy.Internal.ByteString)
instance Yesod.Core.Content.ToFlushBuilder (Data.Conduit.Internal.Conduit.Flush Data.Text.Internal.Lazy.Text)
instance Yesod.Core.Content.ToFlushBuilder (Data.Conduit.Internal.Conduit.Flush Data.Text.Internal.Text)
instance Yesod.Core.Content.ToFlushBuilder (Data.Conduit.Internal.Conduit.Flush GHC.Internal.Base.String)
instance Yesod.Core.Content.ToFlushBuilder (Data.Conduit.Internal.Conduit.Flush Text.Blaze.Html.Html)
instance Yesod.Core.Content.ToFlushBuilder GHC.Internal.Base.String
instance Yesod.Core.Content.ToFlushBuilder Text.Blaze.Html.Html
instance Yesod.Core.Content.ToFlushBuilder Data.Text.Internal.Text
instance Yesod.Core.Content.ToFlushBuilder Data.Text.Internal.Lazy.Text
instance Yesod.Core.Content.ToTypedContent Text.Internal.Css.Css
instance Yesod.Core.Content.ToTypedContent a => Yesod.Core.Content.ToTypedContent (Yesod.Core.Types.DontFullyEvaluate a)
instance Yesod.Core.Content.ToTypedContent Data.Aeson.Encoding.Internal.Encoding
instance Yesod.Core.Content.ToTypedContent (Yesod.Core.Types.JSONResponse a)
instance Yesod.Core.Content.ToTypedContent Text.Julius.Javascript
instance Yesod.Core.Content.ToTypedContent [GHC.Types.Char]
instance Yesod.Core.Content.ToTypedContent Text.Blaze.Html.Html
instance Yesod.Core.Content.ToTypedContent Yesod.Core.Types.RepJson
instance Yesod.Core.Content.ToTypedContent Yesod.Core.Types.RepPlain
instance Yesod.Core.Content.ToTypedContent Yesod.Core.Types.RepXml
instance Yesod.Core.Content.ToTypedContent Data.Text.Internal.Lazy.Text
instance Yesod.Core.Content.ToTypedContent Data.Text.Internal.Text
instance Yesod.Core.Content.ToTypedContent (Yesod.Core.Types.ContentType, Yesod.Core.Types.Content)
instance Yesod.Core.Content.ToTypedContent Yesod.Core.Types.TypedContent
instance Yesod.Core.Content.ToTypedContent ()
instance Yesod.Core.Content.ToTypedContent Data.Aeson.Types.Internal.Value
instance Yesod.Core.Content.ToTypedContent GHC.Internal.Base.Void

module Yesod.Core.Handler

-- | Deprecated: Use HandlerFor directly
type HandlerT site (m :: Type -> Type) = HandlerFor site

-- | A generic handler monad, which can have a different subsite and master
--   site. We define a newtype for better error message.
data HandlerFor site a

-- | Get the master site application argument.
getYesod :: MonadHandler m => m (HandlerSite m)

-- | Get a specific component of the master site application argument.
--   Analogous to the gets function for operating on
--   StateT.
getsYesod :: MonadHandler m => (HandlerSite m -> a) -> m a

-- | Get the URL rendering function.
getUrlRender :: MonadHandler m => m (Route (HandlerSite m) -> Text)

-- | The URL rendering function with query-string parameters.
getUrlRenderParams :: MonadHandler m => m (Route (HandlerSite m) -> [(Text, Text)] -> Text)

-- | Get all the post parameters passed to the handler. To also get the
--   submitted files (if any), you have to use runRequestBody
--   instead of this function.
getPostParams :: MonadHandler m => m [(Text, Text)]

-- | Get the route requested by the user. If this is a 404 response- where
--   the user requested an invalid route- this function will return
--   Nothing.
getCurrentRoute :: MonadHandler m => m (Maybe (Route (HandlerSite m)))
getRequest :: MonadHandler m => m YesodRequest

-- | Get the request's Request value.
waiRequest :: MonadHandler m => m Request
runRequestBody :: MonadHandler m => m RequestBodyContents

-- | Stream in the raw request body without any parsing.
rawRequestBody :: forall (m :: Type -> Type) i. MonadHandler m => ConduitT i ByteString m ()

-- | A tuple containing both the POST parameters and submitted files.
type RequestBodyContents = ([(Text, Text)], [(Text, FileInfo)])

-- | The parsed request information. This type augments the standard WAI
--   Request with additional information.
data YesodRequest
YesodRequest :: ![(Text, Text)] -> ![(Text, Text)] -> !Request -> ![Text] -> !Maybe Text -> !SessionMap -> ![ContentType] -> YesodRequest

-- | Same as queryString, but decoded to Text.
[reqGetParams] :: YesodRequest -> ![(Text, Text)]
[reqCookies] :: YesodRequest -> ![(Text, Text)]
[reqWaiRequest] :: YesodRequest -> !Request

-- | Languages which the client supports. This is an ordered list by
--   preference.
[reqLangs] :: YesodRequest -> ![Text]

-- | A random, session-specific token used to prevent CSRF attacks.
[reqToken] :: YesodRequest -> !Maybe Text

-- | Initial session sent from the client.
--   
--   Since 1.2.0
[reqSession] :: YesodRequest -> !SessionMap

-- | An ordered list of the accepted content types.
--   
--   Since 1.2.0
[reqAccept] :: YesodRequest -> ![ContentType]
data FileInfo
fileName :: FileInfo -> Text
fileContentType :: FileInfo -> Text

-- | Stream the data from the file. Since Yesod 1.2, this has been
--   generalized to work in any MonadResource.
fileSource :: forall (m :: Type -> Type). MonadResource m => FileInfo -> ConduitT () ByteString m ()

-- | Extract a strict ByteString body from a FileInfo.
--   
--   This function will block while reading the file.
--   
--   
--   do
--       fileByteString <- fileSourceByteString fileInfo
--   
fileSourceByteString :: MonadResource m => FileInfo -> m ByteString
fileMove :: FileInfo -> FilePath -> IO ()

-- | Get the list of supported languages supplied by the user.
--   
--   Languages are determined based on the following (in descending order
--   of preference):
--   
--   
--   
- The _LANG get parameter.
--   
- The _LANG user session variable.
--   
- The _LANG cookie.
--   
- Accept-Language HTTP header.
--   
--   
--   Yesod will seek the first language from the returned list matched with
--   languages supporting by your application. This language will be used
--   to render i18n templates. If a matching language is not found the
--   default language will be used.
--   
--   This is handled by parseWaiRequest (not exposed).
--   
--   NOTE: Before version 1.6.19.0, this function
--   prioritized the session variable above all other sources.
languages :: MonadHandler m => m [Text]

-- | Lookup for GET parameters.
lookupGetParam :: MonadHandler m => Text -> m (Maybe Text)
lookupPostParam :: (MonadResource m, MonadHandler m) => Text -> m (Maybe Text)

-- | Lookup for cookie data.
lookupCookie :: MonadHandler m => Text -> m (Maybe Text)

-- | Lookup for POSTed files.
lookupFile :: MonadHandler m => Text -> m (Maybe FileInfo)

-- | Lookup a request header.
lookupHeader :: MonadHandler m => CI ByteString -> m (Maybe ByteString)

-- | Lookup basic authentication data from Authorization header of
--   request. Returns user name and password
lookupBasicAuth :: MonadHandler m => m (Maybe (Text, Text))

-- | Lookup bearer authentication datafrom Authorization header of
--   request. Returns bearer token value
lookupBearerAuth :: MonadHandler m => m (Maybe Text)

-- | Lookup for GET parameters.
lookupGetParams :: MonadHandler m => Text -> m [Text]

-- | Lookup for POST parameters.
lookupPostParams :: (MonadResource m, MonadHandler m) => Text -> m [Text]

-- | Lookup for cookie data.
lookupCookies :: MonadHandler m => Text -> m [Text]

-- | Lookup for POSTed files.
lookupFiles :: MonadHandler m => Text -> m [FileInfo]

-- | Lookup a request header.
lookupHeaders :: MonadHandler m => CI ByteString -> m [ByteString]

-- | Provide a pure value for the response body.
--   
--   
--   respond ct = return . TypedContent ct . toContent
--   
respond :: (Monad m, ToContent a) => ContentType -> a -> m TypedContent

-- | Use a Source for the response body.
--   
--   Note that, for ease of use, the underlying monad is a
--   HandlerFor. This implies that you can run any
--   HandlerFor action. However, since a streaming response occurs
--   after the response headers have already been sent, some actions make
--   no sense here. For example: short-circuit responses, setting headers,
--   changing status codes, etc.
respondSource :: ContentType -> ConduitT () (Flush Builder) (HandlerFor site) () -> HandlerFor site TypedContent

-- | In a streaming response, send a single chunk of data. This function
--   works on most datatypes, such as ByteString and
--   Html.
sendChunk :: forall (m :: Type -> Type) a i. (Monad m, ToFlushBuilder a) => a -> ConduitT i (Flush Builder) m ()

-- | In a streaming response, send a flush command, causing all buffered
--   data to be immediately sent to the client.
sendFlush :: forall (m :: Type -> Type) i. Monad m => ConduitT i (Flush Builder) m ()

-- | Type-specialized version of sendChunk for strict
--   ByteStrings.
sendChunkBS :: forall (m :: Type -> Type) i. Monad m => ByteString -> ConduitT i (Flush Builder) m ()

-- | Type-specialized version of sendChunk for lazy
--   ByteStrings.
sendChunkLBS :: forall (m :: Type -> Type) i. Monad m => ByteString -> ConduitT i (Flush Builder) m ()

-- | Type-specialized version of sendChunk for strict
--   Texts.
sendChunkText :: forall (m :: Type -> Type) i. Monad m => Text -> ConduitT i (Flush Builder) m ()

-- | Type-specialized version of sendChunk for lazy Texts.
sendChunkLazyText :: forall (m :: Type -> Type) i. Monad m => Text -> ConduitT i (Flush Builder) m ()

-- | Type-specialized version of sendChunk for Htmls.
sendChunkHtml :: forall (m :: Type -> Type) i. Monad m => Html -> ConduitT i (Flush Builder) m ()

-- | Some value which can be turned into a URL for redirects.
class RedirectUrl master a

-- | Converts the value to the URL and a list of query-string parameters.
toTextUrl :: (RedirectUrl master a, MonadHandler m, HandlerSite m ~ master) => a -> m Text

-- | Redirect to the given route. HTTP status code 303 for HTTP 1.1 clients
--   and 302 for HTTP 1.0 This is the appropriate choice for a
--   get-following-post technique, which should be the usual use case.
--   
--   If you want direct control of the final status code, or need a
--   different status code, please use redirectWith.
redirect :: (MonadHandler m, RedirectUrl (HandlerSite m) url) => url -> m a

-- | Redirect to the given URL with the specified status code.
redirectWith :: (MonadHandler m, RedirectUrl (HandlerSite m) url) => Status -> url -> m a

-- | Redirect to a POST resource.
--   
--   This is not technically a redirect; instead, it returns an HTML page
--   with a POST form, and some Javascript to automatically submit the
--   form. This can be useful when you need to post a plain link somewhere
--   that needs to cause changes on the server.
redirectToPost :: (MonadHandler m, RedirectUrl (HandlerSite m) url) => url -> m a

-- | Add a fragment identifier to a route to be used when redirecting. For
--   example:
--   
--   
--   redirect (NewsfeedR :#: storyId)
--   
--   
--   @since 1.2.9.
data Fragment a b
(:#:) :: a -> b -> Fragment a b

-- | Return a 404 not found page. Also denotes no handler available.
notFound :: MonadHandler m => m a

-- | Return a 405 method not supported page.
badMethod :: MonadHandler m => m a

-- | Return a 401 status code
notAuthenticated :: MonadHandler m => m a

-- | Return a 403 permission denied page.
permissionDenied :: MonadHandler m => Text -> m a

-- | Return a 403 permission denied page.
permissionDeniedI :: (RenderMessage (HandlerSite m) msg, MonadHandler m) => msg -> m a

-- | Return a 400 invalid arguments page.
invalidArgs :: MonadHandler m => [Text] -> m a

-- | Return a 400 invalid arguments page.
invalidArgsI :: (MonadHandler m, RenderMessage (HandlerSite m) msg) => [msg] -> m a

-- | Bypass remaining handler code and output the given file.
--   
--   For some backends, this is more efficient than reading in the file to
--   memory, since they can optimize file sending via a system call to
--   sendfile.
sendFile :: MonadHandler m => ContentType -> FilePath -> m a

-- | Same as sendFile, but only sends part of a file.
sendFilePart :: MonadHandler m => ContentType -> FilePath -> Integer -> Integer -> m a

-- | Bypass remaining handler code and output the given content with a 200
--   status code.
sendResponse :: (MonadHandler m, ToTypedContent c) => c -> m a

-- | Bypass remaining handler code and output the given content with the
--   given status code.
sendResponseStatus :: (MonadHandler m, ToTypedContent c) => Status -> c -> m a

-- | Bypass remaining handler code and output the given JSON with the given
--   status code.
sendStatusJSON :: (MonadHandler m, ToJSON c) => Status -> c -> m a

-- | Send a 201 Created response with the given route as the
--   Location response header.
sendResponseCreated :: MonadHandler m => Route (HandlerSite m) -> m a

-- | Bypass remaining handler code and output no content with a 204 status
--   code.
sendResponseNoContent :: MonadHandler m => m a

-- | Send a Response. Please note: this function is rarely
--   necessary, and will disregard any changes to response headers
--   and session that you have already specified. This function
--   short-circuits. It should be considered only for very specific needs.
--   If you are not sure if you need it, you don't.
sendWaiResponse :: MonadHandler m => Response -> m b

-- | Switch over to handling the current request with a WAI
--   Application.
sendWaiApplication :: MonadHandler m => Application -> m b

-- | Send a raw response. This is used for cases such as WebSockets.
--   Requires WAI 2.1 or later, and a web server which supports raw
--   responses (e.g., Warp).
sendRawResponse :: (MonadHandler m, MonadUnliftIO m) => (ConduitT () ByteString IO () -> ConduitT ByteString Void IO () -> m ()) -> m a

-- | Send a raw response without conduit. This is used for cases such as
--   WebSockets. Requires WAI 3.0 or later, and a web server which supports
--   raw responses (e.g., Warp).
sendRawResponseNoConduit :: (MonadHandler m, MonadUnliftIO m) => (IO ByteString -> (ByteString -> IO ()) -> m ()) -> m a

-- | Send a 304 not modified response immediately. This is a
--   short-circuiting action.
notModified :: MonadHandler m => m a

-- | Select a representation to send to the client based on the
--   representations provided inside this do-block. Should be used together
--   with provideRep.
selectRep :: MonadHandler m => Writer (Endo [ProvidedRep m]) () -> m TypedContent

-- | Provide a single representation to be used, based on the request of
--   the client. Should be used together with selectRep.
provideRep :: (Monad m, HasContentType a) => m a -> Writer (Endo [ProvidedRep m]) ()

-- | Same as provideRep, but instead of determining the content type
--   from the type of the value itself, you provide the content type
--   separately. This can be a convenience instead of creating newtype
--   wrappers for uncommonly used content types.
--   
--   
--   provideRepType "application/x-special-format" "This is the content"
--   
provideRepType :: (Monad m, ToContent a) => ContentType -> m a -> Writer (Endo [ProvidedRep m]) ()

-- | Internal representation of a single provided representation.
data ProvidedRep (m :: Type -> Type)

-- | Set the cookie on the client.
setCookie :: MonadHandler m => SetCookie -> m ()

-- | Helper function for setCookieExpires value
getExpires :: MonadIO m => Int -> m UTCTime

-- | Unset the cookie on the client.
--   
--   Note: although the value used for key and path is Text, you
--   should only use ASCII values to be HTTP compliant.
deleteCookie :: MonadHandler m => Text -> Text -> m ()

-- | Set an arbitrary response header.
--   
--   Note that, while the data type used here is Text, you must
--   provide only ASCII value to be HTTP compliant.
addHeader :: MonadHandler m => Text -> Text -> m ()

-- | Deprecated synonym for addHeader.

-- | Deprecated: Please use addHeader instead
setHeader :: MonadHandler m => Text -> Text -> m ()

-- | Replace an existing header with a new value or add a new header if not
--   present.
--   
--   Note that, while the data type used here is Text, you must
--   provide only ASCII value to be HTTP compliant.
replaceOrAddHeader :: MonadHandler m => Text -> Text -> m ()

-- | Set the language in the user session. Will show up in languages
--   on the next request.
setLanguage :: MonadHandler m => Text -> m ()

-- | Set attachment file name.
--   
--   Allows Unicode characters by encoding to UTF-8. Some modurn browser
--   parse UTF-8 characters with out encoding setting. But, for example IE9
--   can't parse UTF-8 characters. This function use RFC 6266(RFC
--   5987)
addContentDispositionFileName :: MonadHandler m => Text -> m ()

-- | Set the Cache-Control header to indicate this response should be
--   cached for the given number of seconds.
cacheSeconds :: MonadHandler m => Int -> m ()

-- | Set the Expires header to some date in 2037. In other words, this
--   content is never (realistically) expired.
neverExpires :: MonadHandler m => m ()

-- | Set an Expires header in the past, meaning this content should not be
--   cached.
alreadyExpired :: MonadHandler m => m ()

-- | Set an Expires header to the given date.
expiresAt :: MonadHandler m => UTCTime -> m ()

-- | Check the if-none-match header and, if it matches the given value,
--   return a 304 not modified response. Otherwise, set the etag header to
--   the given value.
--   
--   Note that it is the responsibility of the caller to ensure that the
--   provided value is a valid etag value, no sanity checking is performed
--   by this function.
setEtag :: MonadHandler m => Text -> m ()

-- | Check the if-none-match header and, if it matches the given value,
--   return a 304 not modified response. Otherwise, set the etag header to
--   the given value.
--   
--   A weak etag is only expected to be semantically identical to the prior
--   content, but doesn't have to be byte-for-byte identical. Therefore it
--   can be useful for dynamically generated content that may be difficult
--   to perform bytewise hashing upon.
--   
--   Note that it is the responsibility of the caller to ensure that the
--   provided value is a valid etag value, no sanity checking is performed
--   by this function.
setWeakEtag :: MonadHandler m => Text -> m ()
type SessionMap = Map Text ByteString

-- | Lookup for session data.
lookupSession :: MonadHandler m => Text -> m (Maybe Text)

-- | Lookup for session data in binary format.
lookupSessionBS :: MonadHandler m => Text -> m (Maybe ByteString)

-- | Get all session variables.
getSession :: MonadHandler m => m SessionMap

-- | Set a variable in the user's session.
--   
--   The session is handled by the clientsession package: it sets an
--   encrypted and hashed cookie on the client. This ensures that all data
--   is secure and not tampered with.
setSession :: MonadHandler m => Text -> Text -> m ()

-- | Same as setSession, but uses binary data for the value.
setSessionBS :: MonadHandler m => Text -> ByteString -> m ()

-- | Unsets a session variable. See setSession.
deleteSession :: MonadHandler m => Text -> m ()

-- | Clear all session variables.
--   
--   @since: 1.0.1
clearSession :: MonadHandler m => m ()

-- | Sets the ultimate destination variable to the given route.
--   
--   An ultimate destination is stored in the user session and can be
--   loaded later by redirectUltDest.
setUltDest :: (MonadHandler m, RedirectUrl (HandlerSite m) url) => url -> m ()

-- | Same as setUltDest, but uses the current page.
--   
--   If this is a 404 handler, there is no current page, and then this call
--   does nothing.
setUltDestCurrent :: MonadHandler m => m ()

-- | Sets the ultimate destination to the referer request header, if
--   present.
--   
--   This function will not overwrite an existing ultdest.
setUltDestReferer :: MonadHandler m => m ()

-- | Redirect to the ultimate destination in the user's session. Clear the
--   value from the session.
--   
--   The ultimate destination is set with setUltDest.
--   
--   This function uses redirect, and thus will perform a temporary
--   redirect to a GET request.
redirectUltDest :: (RedirectUrl (HandlerSite m) url, MonadHandler m) => url -> m a

-- | Remove a previously set ultimate destination. See setUltDest.
clearUltDest :: MonadHandler m => m ()

-- | Adds a status and message in the user's session.
--   
--   See getMessages.
addMessage :: MonadHandler m => Text -> Html -> m ()

-- | Adds a message in the user's session but uses RenderMessage to allow
--   for i18n
--   
--   See getMessages.
addMessageI :: (MonadHandler m, RenderMessage (HandlerSite m) msg) => Text -> msg -> m ()

-- | Gets all messages in the user's session, and then clears the variable.
--   
--   See addMessage.
getMessages :: MonadHandler m => m [(Text, Html)]

-- | Calls addMessage with an empty status
setMessage :: MonadHandler m => Html -> m ()

-- | Calls addMessageI with an empty status
setMessageI :: (MonadHandler m, RenderMessage (HandlerSite m) msg) => msg -> m ()

-- | Gets just the last message in the user's session, discards the rest
--   and the status
getMessage :: MonadHandler m => m (Maybe Html)

-- | A handler monad for subsite
data SubHandlerFor sub master a
getSubYesod :: MonadHandler m => m (SubHandlerSite m)
getRouteToParent :: MonadHandler m => m (Route (SubHandlerSite m) -> Route (HandlerSite m))
getSubCurrentRoute :: MonadHandler m => m (Maybe (Route (SubHandlerSite m)))

-- | Wraps the Content generated by hamletToContent in a
--   RepHtml.

-- | Deprecated: Use withUrlRenderer instead
hamletToRepHtml :: MonadHandler m => HtmlUrl (Route (HandlerSite m)) -> m Html

-- | Deprecated synonym for withUrlRenderer.

-- | Deprecated: Use withUrlRenderer instead
giveUrlRenderer :: MonadHandler m => ((Route (HandlerSite m) -> [(Text, Text)] -> Text) -> output) -> m output

-- | Provide a URL rendering function to the given function and return the
--   result. Useful for processing Shakespearean templates.
withUrlRenderer :: MonadHandler m => ((Route (HandlerSite m) -> [(Text, Text)] -> Text) -> output) -> m output

-- | Get a unique identifier.
newIdent :: MonadHandler m => m Text

-- | Returns a function that runs HandlerFor actions inside
--   IO.
--   
--   Sometimes you want to run an inner HandlerFor action outside
--   the control flow of an HTTP request (on the outer HandlerFor
--   action). For example, you may want to spawn a new thread:
--   
--   
--   getFooR :: Handler RepHtml
--   getFooR = do
--     runInnerHandler <- handlerToIO
--     liftIO $ forkIO $ runInnerHandler $ do
--       Code here runs inside HandlerFor but on a new thread.
--       This is the inner HandlerFor.
--       ...
--     Code here runs inside the request's control flow.
--     This is the outer HandlerFor.
--     ...
--   
--   
--   Another use case for this function is creating a stream of server-sent
--   events using HandlerFor actions (see
--   yesod-eventsource).
--   
--   Most of the environment from the outer HandlerFor is preserved
--   on the inner HandlerFor, however:
--   
--   
--   
- The request body is cleared (otherwise it would be very difficult
--   to prevent huge memory leaks).
--   
- The cache is cleared (see cached).
--   
--   
--   Changes to the response made inside the inner HandlerFor are
--   ignored (e.g., session variables, cookies, response headers). This
--   allows the inner HandlerFor to outlive the outer
--   HandlerFor (e.g., on the forkIO example above, a
--   response may be sent to the client without killing the new thread).
handlerToIO :: MonadIO m => HandlerFor site (HandlerFor site a -> m a)

-- | forkIO for a Handler (run an action in the background)
--   
--   Uses handlerToIO, liftResourceT, and resourceForkIO for
--   correctness and efficiency
forkHandler :: (SomeException -> HandlerFor site ()) -> HandlerFor site () -> HandlerFor site ()
getMessageRender :: (MonadHandler m, RenderMessage (HandlerSite m) message) => m (message -> Text)

-- | Use a per-request cache to avoid performing the same action multiple
--   times. Values are stored by their type, the result of typeOf from
--   Typeable. Therefore, you should use different newtype wrappers at each
--   cache site.
--   
--   For example, yesod-auth uses an un-exported newtype, CachedMaybeAuth
--   and exports functions that utilize it such as maybeAuth. This means
--   that another module can create its own newtype wrapper to cache the
--   same type from a different action without any cache conflicts.
--   
--   See the original announcement:
--   http://www.yesodweb.com/blog/2013/03/yesod-1-2-cleaner-internals
cached :: (MonadHandler m, Typeable a) => m a -> m a

-- | Retrieves a value from the cache used by cached.
cacheGet :: (MonadHandler m, Typeable a) => m (Maybe a)

-- | Sets a value in the cache used by cached.
cacheSet :: (MonadHandler m, Typeable a) => a -> m ()

-- | a per-request cache. just like cached. cached can only
--   cache a single value per type. cachedBy stores multiple values
--   per type by usage of a ByteString key
--   
--   cached is ideal to cache an action that has only one value of a
--   type, such as the session's current user cachedBy is required
--   if the action has parameters and can return multiple values per type.
--   You can turn those parameters into a ByteString cache key. For
--   example, caching a lookup of a Link by a token where multiple token
--   lookups might be performed.
cachedBy :: (MonadHandler m, Typeable a) => ByteString -> m a -> m a

-- | Retrieves a value from the cache used by cachedBy.
cacheByGet :: (MonadHandler m, Typeable a) => ByteString -> m (Maybe a)

-- | Sets a value in the cache used by cachedBy.
cacheBySet :: (MonadHandler m, Typeable a) => ByteString -> a -> m ()

-- | Sets a cookie with a CSRF token, using defaultCsrfCookieName
--   for the cookie name.
--   
--   The cookie's path is set to /, making it valid for your whole
--   website.
setCsrfCookie :: MonadHandler m => m ()

-- | Takes a SetCookie and overrides its value with a CSRF token,
--   then sets the cookie.
--   
--   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
--   /.
setCsrfCookieWithCookie :: MonadHandler m => SetCookie -> m ()

-- | The default cookie name for the CSRF token ("XSRF-TOKEN").
defaultCsrfCookieName :: ByteString

-- | Takes a header name to lookup a CSRF token. If the value doesn't match
--   the token stored in the session, this function throws a
--   PermissionDenied error.
checkCsrfHeaderNamed :: MonadHandler m => CI ByteString -> m ()

-- | Takes a header name to lookup a CSRF token, and returns whether the
--   value matches the token stored in the session.
hasValidCsrfHeaderNamed :: MonadHandler m => CI ByteString -> m Bool

-- | The default header name for the CSRF token ("X-XSRF-TOKEN").
defaultCsrfHeaderName :: CI ByteString

-- | Takes a POST parameter name to lookup a CSRF token, and returns
--   whether the value matches the token stored in the session.
hasValidCsrfParamNamed :: MonadHandler m => Text -> m Bool

-- | Takes a POST parameter name to lookup a CSRF token. If the value
--   doesn't match the token stored in the session, this function throws a
--   PermissionDenied error.
checkCsrfParamNamed :: MonadHandler m => Text -> m ()

-- | The default parameter name for the CSRF token ("_token")
defaultCsrfParamName :: Text

-- | Checks that a valid CSRF token is present in either the request
--   headers or POST parameters. If the value doesn't match the token
--   stored in the session, this function throws a PermissionDenied
--   error.
checkCsrfHeaderOrParam :: (MonadHandler m, MonadLogger m) => CI ByteString -> Text -> m ()
instance GHC.Classes.Eq Yesod.Core.Handler.Etag
instance (Yesod.Core.Handler.RedirectUrl master a, Web.PathPieces.PathPiece b) => Yesod.Core.Handler.RedirectUrl master (Yesod.Core.Handler.Fragment a b)
instance Yesod.Core.Handler.RedirectUrl master GHC.Internal.Base.String
instance Yesod.Core.Handler.RedirectUrl master (Yesod.Routes.Class.Route master)
instance Yesod.Core.Handler.RedirectUrl master Data.Text.Internal.Text
instance (key GHC.Types.~ Data.Text.Internal.Text, val GHC.Types.~ Data.Text.Internal.Text) => Yesod.Core.Handler.RedirectUrl master (Yesod.Routes.Class.Route master, [(key, val)])
instance (key GHC.Types.~ Data.Text.Internal.Text, val GHC.Types.~ Data.Text.Internal.Text) => Yesod.Core.Handler.RedirectUrl master (Yesod.Routes.Class.Route master, Data.Map.Internal.Map key val)
instance GHC.Internal.Show.Show Yesod.Core.Handler.Etag
instance (GHC.Internal.Show.Show a, GHC.Internal.Show.Show b) => GHC.Internal.Show.Show (Yesod.Core.Handler.Fragment a b)

-- | Widgets combine HTML with JS and CSS dependencies with a unique
--   identifier generator, allowing you to create truly modular HTML
--   components.
module Yesod.Core.Widget

-- | Deprecated: Use WidgetFor directly
type WidgetT site (m :: Type -> Type) = WidgetFor site

-- | 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.
data WidgetFor site a

-- | 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
--   
data PageContent url
PageContent :: !Html -> !Maybe Text -> !HtmlUrl url -> !HtmlUrl url -> PageContent url
[pageTitle] :: PageContent url -> !Html
[pageDescription] :: PageContent url -> !Maybe Text
[pageHead] :: PageContent url -> !HtmlUrl url
[pageBody] :: PageContent url -> !HtmlUrl url
whamlet :: QuasiQuoter
whamletFile :: FilePath -> Q Exp

-- | Wraps the Content generated by hamletToContent in a
--   RepHtml.

-- | Deprecated: Please use ihamletToHtml instead
ihamletToRepHtml :: (MonadHandler m, RenderMessage (HandlerSite m) message) => HtmlUrlI18n message (Route (HandlerSite m)) -> m Html

-- | Wraps the Content generated by hamletToContent in a
--   RepHtml.
--   
--   Since 1.2.1
ihamletToHtml :: (MonadHandler m, RenderMessage (HandlerSite m) message) => HtmlUrlI18n message (Route (HandlerSite m)) -> m Html
class ToWidget site a
toWidget :: (ToWidget site a, MonadWidget m, HandlerSite m ~ site) => a -> m ()
class ToWidgetHead site a
toWidgetHead :: (ToWidgetHead site a, MonadWidget m, HandlerSite m ~ site) => a -> m ()
class ToWidgetBody site a
toWidgetBody :: (ToWidgetBody site a, MonadWidget m, HandlerSite m ~ site) => a -> m ()

-- | Allows adding some CSS to the page with a specific media type.
--   
--   Since 1.2
class ToWidgetMedia site a

-- | Add the given content to the page, but only for the given media type.
--   
--   Since 1.2
toWidgetMedia :: (ToWidgetMedia site a, MonadWidget m, HandlerSite m ~ site) => Text -> a -> m ()

-- | Set the page title.
--   
--   Calling setTitle or setTitleI multiple times
--   overrides previously set values.
--   
--   SEO Notes:
--   
--   
--   
- Title tags are the second most important on-page factor for SEO,
--   after content
--   
- Every page should have a unique title tag
--   
- Start your title tag with your main targeted keyword
--   
- Don't stuff your keywords
--   
- Google typically shows 55-64 characters, so aim to keep your title
--   length under 60 characters
--   
setTitle :: MonadWidget m => Html -> m ()

-- | Set the localised page title.
--   
--   n.b. See comments for setTitle
setTitleI :: (MonadWidget m, RenderMessage (HandlerSite m) msg) => msg -> m ()

-- | Add description meta tag to the head of the page
--   
--   Google does not use the description tag as a ranking signal, but the
--   contents of this tag will likely affect your click-through rate since
--   it shows up in search results.
--   
--   The average length of the description shown in Google's search results
--   is about 160 characters on desktop, and about 130 characters on
--   mobile, at time of writing.
--   
--   Source:
--   https://www.advancedwebranking.com/blog/meta-tags-important-in-seo/

-- | Warning: setDescription is not idempotent; we recommend
--   setDescriptionIdemp insteadMultiple calls to setDescription will
--   insert multiple meta tags in the page head.If you want an idempotent
--   function, use setDescriptionIdemp - but if you do, you may need to
--   change your layout to include pageDescription.
setDescription :: MonadWidget m => Text -> m ()

-- | Add translated description meta tag to the head of the page
--   
--   n.b. See comments for setDescription.

-- | Warning: setDescriptionI is not idempotent; we recommend
--   setDescriptionIdempI insteadMultiple calls to setDescriptionI will
--   insert multiple meta tags in the page head.If you want an idempotent
--   function, use setDescriptionIdempI - but if you do, you may need to
--   change your layout to include pageDescription.
setDescriptionI :: (MonadWidget m, RenderMessage (HandlerSite m) msg) => msg -> m ()

-- | Add description meta tag to the head of the page
--   
--   Google does not use the description tag as a ranking signal, but the
--   contents of this tag will likely affect your click-through rate since
--   it shows up in search results.
--   
--   The average length of the description shown in Google's search results
--   is about 160 characters on desktop, and about 130 characters on
--   mobile, at time of writing.
--   
--   Unlike setDescription, this version is *idempotent* - calling
--   it multiple times will result in only a single description meta tag in
--   the head.
--   
--   Source:
--   https://www.advancedwebranking.com/blog/meta-tags-important-in-seo/
setDescriptionIdemp :: MonadWidget m => Text -> m ()

-- | Add translated description meta tag to the head of the page
--   
--   n.b. See comments for setDescriptionIdemp.
--   
--   Unlike setDescriptionI, this version is *idempotent* - calling
--   it multiple times will result in only a single description meta tag in
--   the head.
setDescriptionIdempI :: (MonadWidget m, RenderMessage (HandlerSite m) msg) => msg -> m ()

-- | Add OpenGraph type meta tag to the head of the page
--   
--   See all available OG types here: https://ogp.me/#types
setOGType :: MonadWidget m => Text -> m ()

-- | Add OpenGraph image meta tag to the head of the page
--   
--   Best practices:
--   
--   
--   
- Use custom images for shareable pages, e.g., homepage, articles,
--   etc.
--   
- Use your logo or any other branded image for the rest of your
--   pages.
--   
- Use images with a 1.91:1 ratio and minimum recommended dimensions
--   of 1200x630 for optimal clarity across all devices.
--   
--   
--   Source: https://ahrefs.com/blog/open-graph-meta-tags/
setOGImage :: MonadWidget m => Text -> m ()

-- | Link to the specified local stylesheet.
addStylesheet :: MonadWidget m => Route (HandlerSite m) -> m ()

-- | Link to the specified local stylesheet.
addStylesheetAttrs :: MonadWidget m => Route (HandlerSite m) -> [(Text, Text)] -> m ()

-- | Link to the specified remote stylesheet.
addStylesheetRemote :: MonadWidget m => Text -> m ()

-- | Link to the specified remote stylesheet.
addStylesheetRemoteAttrs :: MonadWidget m => Text -> [(Text, Text)] -> m ()
addStylesheetEither :: MonadWidget m => Either (Route (HandlerSite m)) Text -> m ()

-- | Newtype wrapper allowing injection of arbitrary content into CSS.
--   
--   Usage:
--   
--   
--   toWidget $ CssBuilder "p { color: red }"
--   
--   
--   Since: 1.1.3
newtype CssBuilder
CssBuilder :: Builder -> CssBuilder
[unCssBuilder] :: CssBuilder -> Builder

-- | Link to the specified local script.
addScript :: MonadWidget m => Route (HandlerSite m) -> m ()

-- | Link to the specified local script.
addScriptAttrs :: MonadWidget m => Route (HandlerSite m) -> [(Text, Text)] -> m ()

-- | Link to the specified remote script.
addScriptRemote :: MonadWidget m => Text -> m ()

-- | Link to the specified remote script.
addScriptRemoteAttrs :: MonadWidget m => Text -> [(Text, Text)] -> m ()
addScriptEither :: MonadWidget m => Either (Route (HandlerSite m)) Text -> m ()
handlerToWidget :: HandlerFor site a -> WidgetFor site a
whamletFileWithSettings :: HamletSettings -> FilePath -> Q Exp
asWidgetT :: forall site (m :: Type -> Type). WidgetT site m () -> WidgetT site m ()
instance (render GHC.Types.~ Yesod.Core.Types.RY site) => Yesod.Core.Widget.ToWidgetBody site (render -> Text.Blaze.Html.Html)
instance (render GHC.Types.~ Yesod.Core.Types.RY site) => Yesod.Core.Widget.ToWidgetBody site (render -> Text.Julius.Javascript)
instance Yesod.Core.Widget.ToWidgetBody site Text.Julius.Javascript
instance Yesod.Core.Widget.ToWidgetBody site Text.Blaze.Html.Html
instance Yesod.Core.Widget.ToWidgetHead site Text.Internal.Css.Css
instance Yesod.Core.Widget.ToWidgetHead site Yesod.Core.Types.CssBuilder
instance (render GHC.Types.~ Yesod.Core.Types.RY site) => Yesod.Core.Widget.ToWidgetHead site (render -> Text.Blaze.Html.Html)
instance (render GHC.Types.~ Yesod.Core.Types.RY site) => Yesod.Core.Widget.ToWidgetHead site (render -> Text.Internal.Css.Css)
instance (render GHC.Types.~ Yesod.Core.Types.RY site) => Yesod.Core.Widget.ToWidgetHead site (render -> Yesod.Core.Types.CssBuilder)
instance (render GHC.Types.~ Yesod.Core.Types.RY site) => Yesod.Core.Widget.ToWidgetHead site (render -> Text.Julius.Javascript)
instance Yesod.Core.Widget.ToWidgetHead site Text.Julius.Javascript
instance Yesod.Core.Widget.ToWidgetHead site Text.Blaze.Html.Html
instance Yesod.Core.Widget.ToWidgetMedia site Text.Internal.Css.Css
instance Yesod.Core.Widget.ToWidgetMedia site Yesod.Core.Types.CssBuilder
instance (render GHC.Types.~ Yesod.Core.Types.RY site) => Yesod.Core.Widget.ToWidgetMedia site (render -> Text.Internal.Css.Css)
instance (render GHC.Types.~ Yesod.Core.Types.RY site) => Yesod.Core.Widget.ToWidgetMedia site (render -> Yesod.Core.Types.CssBuilder)
instance (site' GHC.Types.~ site, a GHC.Types.~ ()) => Yesod.Core.Widget.ToWidget site' (Yesod.Core.Types.WidgetFor site a)
instance Yesod.Core.Widget.ToWidget site Data.Text.Internal.Builder.Builder
instance Yesod.Core.Widget.ToWidget site Text.Internal.Css.Css
instance Yesod.Core.Widget.ToWidget site Yesod.Core.Types.CssBuilder
instance (render GHC.Types.~ Yesod.Core.Types.RY site) => Yesod.Core.Widget.ToWidget site (render -> Text.Blaze.Html.Html)
instance (render GHC.Types.~ Yesod.Core.Types.RY site) => Yesod.Core.Widget.ToWidget site (render -> Text.Internal.Css.Css)
instance (render GHC.Types.~ Yesod.Core.Types.RY site) => Yesod.Core.Widget.ToWidget site (render -> Yesod.Core.Types.CssBuilder)
instance (render GHC.Types.~ Yesod.Core.Types.RY site) => Yesod.Core.Widget.ToWidget site (render -> Text.Julius.Javascript)
instance Yesod.Core.Widget.ToWidget site Text.Julius.Javascript
instance Yesod.Core.Widget.ToWidget site Text.Blaze.Html.Html
instance Yesod.Core.Widget.ToWidget site Data.Text.Internal.Lazy.Text
instance Yesod.Core.Widget.ToWidget site Data.Text.Internal.Text

module Yesod.Core.Json

-- | Provide both an HTML and JSON representation for a piece of data,
--   using the default layout for the HTML output (defaultLayout).
defaultLayoutJson :: (Yesod site, ToJSON a) => WidgetFor site () -> HandlerFor site a -> HandlerFor site TypedContent

-- | Wraps a data type in a RepJson. The data type must support
--   conversion to JSON via ToJSON.

-- | Deprecated: Use returnJson instead
jsonToRepJson :: (Monad m, ToJSON a) => a -> m Value

-- | Convert a value to a JSON representation via aeson's toJSON
--   function.
returnJson :: (Monad m, ToJSON a) => a -> m Value

-- | Convert a value to a JSON representation via aeson's toEncoding
--   function.
returnJsonEncoding :: (Monad m, ToJSON a) => a -> m Encoding

-- | Provide a JSON representation for usage with selectReps,
--   using aeson's toJSON (aeson >= 0.11: toEncoding)
--   function to perform the conversion.
provideJson :: forall (m :: Type -> Type) a. (Monad m, ToJSON a) => a -> Writer (Endo [ProvidedRep m]) ()

-- | Parse the request body to a data type as a JSON value. The data type
--   must support conversion from JSON via FromJSON. If you want the
--   raw JSON value, just ask for a Result Value.
--   
--   The MIME type must indicate JSON content. Requiring a JSON
--   content-type helps secure your site against CSRF attacks (browsers
--   will perform POST requests for form and text/plain content-types
--   without doing a CORS check, and those content-types can easily contain
--   valid JSON).
--   
--   Note that this function will consume the request body. As such,
--   calling it twice will result in a parse error on the second call,
--   since the request body will no longer be available.
parseCheckJsonBody :: (MonadHandler m, FromJSON a) => m (Result a)

-- | Same as parseCheckJsonBody, but does not check that the mime
--   type indicates JSON content.
--   
--   Note: This function is vulnerable to CSRF attacks.
parseInsecureJsonBody :: (MonadHandler m, FromJSON a) => m (Result a)

-- | Same as parseCheckJsonBody, but return an invalid args response
--   on a parse error.
requireCheckJsonBody :: (MonadHandler m, FromJSON a) => m a

-- | Same as parseInsecureJsonBody, but return an invalid args
--   response on a parse error.
requireInsecureJsonBody :: (MonadHandler m, FromJSON a) => m a

-- | Same as parseInsecureJsonBody

-- | Deprecated: Use parseCheckJsonBody or parseInsecureJsonBody
--   instead
parseJsonBody :: (MonadHandler m, FromJSON a) => m (Result a)

-- | Same as parseInsecureJsonBody, but return an invalid args
--   response on a parse error.

-- | Deprecated: Use requireCheckJsonBody or requireInsecureJsonBody
--   instead
parseJsonBody_ :: (MonadHandler m, FromJSON a) => m a

-- | Same as parseInsecureJsonBody, but return an invalid args
--   response on a parse error.

-- | Deprecated: Use requireCheckJsonBody or requireInsecureJsonBody
--   instead
requireJsonBody :: (MonadHandler m, FromJSON a) => m a

-- | A JSON value represented as a Haskell value.
data Value
Object :: !Object -> Value
Array :: !Array -> Value
String :: !Text -> Value
Number :: !Scientific -> Value
Bool :: !Bool -> Value
Null :: Value

-- | A type that can be converted to JSON.
--   
--   Instances in general must specify toJSON and
--   should (but don't need to) specify toEncoding.
--   
--   An example type and instance:
--   
--   
--   -- Allow ourselves to write Text literals.
--   {-# LANGUAGE OverloadedStrings #-}
--   
--   data Coord = Coord { x :: Double, y :: Double }
--   
--   instance ToJSON Coord where
--     toJSON (Coord x y) = object ["x" .= x, "y" .= y]
--   
--     toEncoding (Coord x y) = pairs ("x" .= x <> "y" .= y)
--   
--   
--   Instead of manually writing your ToJSON instance, there are two
--   options to do it automatically:
--   
--   
--   
- Data.Aeson.TH provides Template Haskell functions which
--   will derive an instance at compile time. The generated instance is
--   optimized for your type so it will probably be more efficient than the
--   following option.
--   
- The compiler can provide a default generic implementation for
--   toJSON.
--   
--   
--   To use the second, simply add a deriving Generic
--   clause to your datatype and declare a ToJSON instance. If you
--   require nothing other than defaultOptions, it is sufficient to
--   write (and this is the only alternative where the default
--   toJSON implementation is sufficient):
--   
--   
--   {-# LANGUAGE DeriveGeneric #-}
--   
--   import GHC.Generics
--   
--   data Coord = Coord { x :: Double, y :: Double } deriving Generic
--   
--   instance ToJSON Coord where
--       toEncoding = genericToEncoding defaultOptions
--   
--   
--   or more conveniently using the DerivingVia extension
--   
--   
--   deriving via Generically Coord instance ToJSON Coord
--   
--   
--   If on the other hand you wish to customize the generic decoding, you
--   have to implement both methods:
--   
--   
--   customOptions = defaultOptions
--                   { fieldLabelModifier = map toUpper
--                   }
--   
--   instance ToJSON Coord where
--       toJSON     = genericToJSON customOptions
--       toEncoding = genericToEncoding customOptions
--   
--   
--   Previous versions of this library only had the toJSON method.
--   Adding toEncoding had two reasons:
--   
--   
--   
- toEncoding is more efficient for the common case that the
--   output of toJSON is directly serialized to a
--   ByteString. Further, expressing either method in terms of the
--   other would be non-optimal.
--   
- The choice of defaults allows a smooth transition for existing
--   users: Existing instances that do not define toEncoding still
--   compile and have the correct semantics. This is ensured by making the
--   default implementation of toEncoding use toJSON. This
--   produces correct results, but since it performs an intermediate
--   conversion to a Value, it will be less efficient than directly
--   emitting an Encoding. (this also means that specifying nothing
--   more than instance ToJSON Coord would be sufficient as a
--   generically decoding instance, but there probably exists no good
--   reason to not specify toEncoding in new instances.)
--   
class ToJSON a

-- | Convert a Haskell value to a JSON-friendly intermediate type.
toJSON :: ToJSON a => a -> Value
($dmtoJSON) :: (ToJSON a, Generic a, GToJSON' Value Zero (Rep a)) => a -> Value

-- | Encode a Haskell value as JSON.
--   
--   The default implementation of this method creates an intermediate
--   Value using toJSON. This provides source-level
--   compatibility for people upgrading from older versions of this
--   library, but obviously offers no performance advantage.
--   
--   To benefit from direct encoding, you must provide an
--   implementation for this method. The easiest way to do so is by having
--   your types implement Generic using the DeriveGeneric
--   extension, and then have GHC generate a method body as follows.
--   
--   
--   instance ToJSON Coord where
--       toEncoding = genericToEncoding defaultOptions
--   
toEncoding :: ToJSON a => a -> Encoding
toJSONList :: ToJSON a => [a] -> Value
toEncodingList :: ToJSON a => [a] -> Encoding

-- | Defines when it is acceptable to omit a field of this type from a
--   record. Used by (.?=) operator, and Generics and TH
--   deriving with omitNothingFields = True.
omitField :: ToJSON a => a -> Bool

-- | A type that can be converted from JSON, with the possibility of
--   failure.
--   
--   In many cases, you can get the compiler to generate parsing code for
--   you (see below). To begin, let's cover writing an instance by hand.
--   
--   There are various reasons a conversion could fail. For example, an
--   Object could be missing a required key, an Array could
--   be of the wrong size, or a value could be of an incompatible type.
--   
--   The basic ways to signal a failed conversion are as follows:
--   
--   
--   
- fail yields a custom error message: it is the recommended
--   way of reporting a failure;
--   
- empty (or mzero) is uninformative: use it when the
--   error is meant to be caught by some (<|>);
--   
- typeMismatch can be used to report a failure when the
--   encountered value is not of the expected JSON type; unexpected
--   is an appropriate alternative when more than one type may be expected,
--   or to keep the expected type implicit.
--   
--   
--   prependFailure (or modifyFailure) add more information
--   to a parser's error messages.
--   
--   An example type and instance using typeMismatch and
--   prependFailure:
--   
--   
--   -- Allow ourselves to write Text literals.
--   {-# LANGUAGE OverloadedStrings #-}
--   
--   data Coord = Coord { x :: Double, y :: Double }
--   
--   instance FromJSON Coord where
--       parseJSON (Object v) = Coord
--           <$> v .: "x"
--           <*> v .: "y"
--   
--       -- We do not expect a non-Object value here.
--       -- We could use empty to fail, but typeMismatch
--       -- gives a much more informative error message.
--       parseJSON invalid    =
--           prependFailure "parsing Coord failed, "
--               (typeMismatch "Object" invalid)
--   
--   
--   For this common case of only being concerned with a single type of
--   JSON value, the functions withObject, withScientific,
--   etc. are provided. Their use is to be preferred when possible, since
--   they are more terse. Using withObject, we can rewrite the above
--   instance (assuming the same language extension and data type) as:
--   
--   
--   instance FromJSON Coord where
--       parseJSON = withObject "Coord" $ \v -> Coord
--           <$> v .: "x"
--           <*> v .: "y"
--   
--   
--   Instead of manually writing your FromJSON instance, there are
--   two options to do it automatically:
--   
--   
--   
- Data.Aeson.TH provides Template Haskell functions which
--   will derive an instance at compile time. The generated instance is
--   optimized for your type so it will probably be more efficient than the
--   following option.
--   
- The compiler can provide a default generic implementation for
--   parseJSON.
--   
--   
--   To use the second, simply add a deriving Generic
--   clause to your datatype and declare a FromJSON instance for
--   your datatype without giving a definition for parseJSON.
--   
--   For example, the previous example can be simplified to just:
--   
--   
--   {-# LANGUAGE DeriveGeneric #-}
--   
--   import GHC.Generics
--   
--   data Coord = Coord { x :: Double, y :: Double } deriving Generic
--   
--   instance FromJSON Coord
--   
--   
--   or using the DerivingVia extension
--   
--   
--   deriving via Generically Coord instance FromJSON Coord
--   
--   
--   The default implementation will be equivalent to parseJSON =
--   genericParseJSON defaultOptions; if you need
--   different options, you can customize the generic decoding by defining:
--   
--   
--   customOptions = defaultOptions
--                   { fieldLabelModifier = map toUpper
--                   }
--   
--   instance FromJSON Coord where
--       parseJSON = genericParseJSON customOptions
--   
class FromJSON a
parseJSON :: FromJSON a => Value -> Parser a
($dmparseJSON) :: (FromJSON a, Generic a, GFromJSON Zero (Rep a)) => Value -> Parser a
parseJSONList :: FromJSON a => Value -> Parser [a]

-- | Default value for optional fields. Used by (.:?=)
--   operator, and Generics and TH deriving with
--   allowOmittedFields = True (default).
omittedField :: FromJSON a => Maybe a

-- | Convert a list of values to an Array.
array :: ToJSON a => [a] -> Value

-- | Create a Value from a list of name/value Pairs. If
--   duplicate keys arise, later keys and their associated values win.
object :: [Pair] -> Value
(.=) :: (KeyValue e kv, ToJSON v) => Key -> v -> kv
infixr 8 .=

-- | Retrieve the value associated with the given key of an Object.
--   The result is empty if the key is not present or the value
--   cannot be converted to the desired type.
--   
--   This accessor is appropriate if the key and value must be
--   present in an object for it to be valid. If the key and value are
--   optional, use .:? instead.
(.:) :: FromJSON a => Object -> Key -> Parser a

-- | jsonOrRedirect simplifies the scenario where a POST handler sends a
--   different response based on Accept headers:
--   
--   
--   
- 200 with JSON data if the client prefers application/json
--   (e.g. AJAX, see acceptsJSON).
--   
- 3xx otherwise, following the PRG pattern.
--   
jsonOrRedirect :: (MonadHandler m, ToJSON a) => Route (HandlerSite m) -> a -> m Value

-- | jsonEncodingOrRedirect simplifies the scenario where a POST handler
--   sends a different response based on Accept headers:
--   
--   
--   
- 200 with JSON data if the client prefers application/json
--   (e.g. AJAX, see acceptsJSON).
--   
- 3xx otherwise, following the PRG pattern. @since 1.4.21
--   
jsonEncodingOrRedirect :: (MonadHandler m, ToJSON a) => Route (HandlerSite m) -> a -> m Encoding

-- | Returns True if the client prefers application/json
--   as indicated by the Accept HTTP header.
acceptsJson :: MonadHandler m => m Bool

-- | Given the Content-Type header, returns if it is JSON.
--   
--   This function is currently a simple check for
--   application/json, but in the future may check for alternative
--   representations such as xxx/yyy+json.
contentTypeHeaderIsJson :: ByteString -> Bool

-- | This is designed to be used as
--   
--   
--   import qualified Yesod.Core.Unsafe as Unsafe
--   
--   
--   This serves as a reminder that the functions are unsafe to use in many
--   situations.
module Yesod.Core.Unsafe

-- | Run a HandlerFor completely outside of Yesod. This function
--   comes with many caveats and you shouldn't use it unless you fully
--   understand what it's doing and how it works.
--   
--   As of now, there's only one reason to use this function at all: in
--   order to run unit tests of functions inside HandlerFor but that
--   aren't easily testable with a full HTTP request. Even so, it's better
--   to use wai-test or yesod-test instead of using this
--   function.
--   
--   This function will create a fake HTTP request (both wai's
--   Request and yesod's Request) and feed it to the
--   HandlerFor. The only useful information the
--   HandlerFor may get from the request is the session map, which
--   you must supply as argument to runFakeHandler. All other
--   fields contain fake information, which means that they can be accessed
--   but won't have any useful information. The response of the
--   HandlerFor is completely ignored, including changes to the
--   session, cookies or headers. We only return you the
--   HandlerFor's return value.
runFakeHandler :: (Yesod site, MonadIO m) => SessionMap -> (site -> Logger) -> site -> HandlerFor site a -> m (Either ErrorResponse a)

-- | designed to be used as
--   
--   
--   unsafeHandler = Unsafe.fakeHandlerGetLogger appLogger
--   
fakeHandlerGetLogger :: (Yesod site, MonadIO m) => (site -> Logger) -> site -> HandlerFor site a -> m a

-- | Warning! This module is considered internal and may have breaking
--   changes
module Yesod.Routes.TH.Types
data Resource typ
Resource :: String -> [Piece typ] -> Dispatch typ -> [String] -> CheckOverlap -> Resource typ
[resourceName] :: Resource typ -> String
[resourcePieces] :: Resource typ -> [Piece typ]
[resourceDispatch] :: Resource typ -> Dispatch typ
[resourceAttrs] :: Resource typ -> [String]
[resourceCheck] :: Resource typ -> CheckOverlap
data ResourceTree typ
ResourceLeaf :: Resource typ -> ResourceTree typ
ResourceParent :: String -> CheckOverlap -> [Piece typ] -> [ResourceTree typ] -> ResourceTree typ
data Piece typ
Static :: String -> Piece typ
Dynamic :: typ -> Piece typ
data Dispatch typ
Methods :: Maybe typ -> [String] -> Dispatch typ

-- | type of the multi piece at the end
[methodsMulti] :: Dispatch typ -> Maybe typ

-- | supported request methods
[methodsMethods] :: Dispatch typ -> [String]
Subsite :: typ -> String -> Dispatch typ
[subsiteType] :: Dispatch typ -> typ
[subsiteFunc] :: Dispatch typ -> String
type CheckOverlap = Bool
data FlatResource a
FlatResource :: [(String, [Piece a])] -> String -> [Piece a] -> Dispatch a -> Bool -> FlatResource a
[frParentPieces] :: FlatResource a -> [(String, [Piece a])]
[frName] :: FlatResource a -> String
[frPieces] :: FlatResource a -> [Piece a]
[frDispatch] :: FlatResource a -> Dispatch a
[frCheck] :: FlatResource a -> Bool
resourceMulti :: Resource typ -> Maybe typ
resourceTreePieces :: ResourceTree typ -> [Piece typ]
resourceTreeName :: ResourceTree typ -> String
flatten :: [ResourceTree a] -> [FlatResource a]
instance GHC.Internal.Base.Functor Yesod.Routes.TH.Types.Dispatch
instance GHC.Internal.Base.Functor Yesod.Routes.TH.Types.Piece
instance GHC.Internal.Base.Functor Yesod.Routes.TH.Types.Resource
instance GHC.Internal.Base.Functor Yesod.Routes.TH.Types.ResourceTree
instance Language.Haskell.TH.Syntax.Lift typ => Language.Haskell.TH.Syntax.Lift (Yesod.Routes.TH.Types.Dispatch typ)
instance Language.Haskell.TH.Syntax.Lift typ => Language.Haskell.TH.Syntax.Lift (Yesod.Routes.TH.Types.Piece typ)
instance Language.Haskell.TH.Syntax.Lift typ => Language.Haskell.TH.Syntax.Lift (Yesod.Routes.TH.Types.Resource typ)
instance Language.Haskell.TH.Syntax.Lift typ => Language.Haskell.TH.Syntax.Lift (Yesod.Routes.TH.Types.ResourceTree typ)
instance GHC.Internal.Show.Show typ => GHC.Internal.Show.Show (Yesod.Routes.TH.Types.Dispatch typ)
instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Yesod.Routes.TH.Types.FlatResource a)
instance GHC.Internal.Show.Show typ => GHC.Internal.Show.Show (Yesod.Routes.TH.Types.Piece typ)
instance GHC.Internal.Show.Show typ => GHC.Internal.Show.Show (Yesod.Routes.TH.Types.Resource typ)
instance GHC.Internal.Show.Show typ => GHC.Internal.Show.Show (Yesod.Routes.TH.Types.ResourceTree typ)

-- | Exposed mostly for testing. These functions provide an unstable API
--   and should not be relied upon.
module Yesod.Core.Internal

-- | Generate a random String of alphanumerical characters (a-z, A-Z, and
--   0-9) of the given length using the given random number generator.
randomString :: Monad m => Int -> m Int -> m Text
parseWaiRequest :: Request -> SessionMap -> Bool -> Maybe Word64 -> Either (IO YesodRequest) (IO Int -> IO YesodRequest)
mkYesodGeneral :: [[String]] -> String -> [String] -> Bool -> (Exp -> Q Exp) -> [ResourceTree String] -> Q ([Dec], [Dec])

module Yesod.Core.Dispatch

-- | A quasi-quoter to parse a string into a list of Resources.
--   Checks for overlapping routes, failing if present; use
--   parseRoutesNoCheck to skip the checking. See documentation site
--   for details on syntax.
parseRoutes :: QuasiQuoter

-- | Same as parseRoutes, but performs no overlap checking.
parseRoutesNoCheck :: QuasiQuoter

-- | Same as parseRoutes, but uses an external file instead of
--   quasiquotation.
--   
--   The recommended file extension is .yesodroutes.
parseRoutesFile :: FilePath -> Q Exp

-- | Same as parseRoutesNoCheck, but uses an external file instead
--   of quasiquotation.
--   
--   The recommended file extension is .yesodroutes.
parseRoutesFileNoCheck :: FilePath -> Q Exp

-- | Generates URL datatype and site function for the given
--   Resources. This is used for creating sites, not
--   subsites. See mkYesodSubData and mkYesodSubDispatch for
--   the latter. Use parseRoutes to create the Resources.
--   
--   Contexts and type variables in the name of the datatype are parsed.
--   For example, a datatype App a with typeclass constraint
--   MyClass a can be written as "(MyClass a) => App
--   a".
mkYesod :: String -> [ResourceTree String] -> Q [Dec]

-- | mkYesod but with custom options.
mkYesodOpts :: RouteOpts -> String -> [ResourceTree String] -> Q [Dec]

-- | Similar to mkYesod, except contexts and type variables are not
--   parsed. Instead, they are explicitly provided. You can write
--   (MyClass a) => App a with mkYesodWith
--   [["MyClass","a"]] "App" ["a"] ....

-- | Deprecated: Contexts and type variables are now parsed from the
--   name in mkYesod.
--   https://github.com/yesodweb/yesod/pull/1366
mkYesodWith :: [[String]] -> String -> [String] -> [ResourceTree String] -> Q [Dec]

-- | Sometimes, you will want to declare your routes in one file and define
--   your handlers elsewhere. For example, this is the only way to break up
--   a monolithic file into smaller parts. Use this function, paired with
--   mkYesodDispatch, to do just that.
mkYesodData :: String -> [ResourceTree String] -> Q [Dec]

-- | mkYesodData but with custom options.
mkYesodDataOpts :: RouteOpts -> String -> [ResourceTree String] -> Q [Dec]
mkYesodSubData :: String -> [ResourceTree String] -> Q [Dec]

mkYesodSubDataOpts :: RouteOpts -> String -> [ResourceTree String] -> Q [Dec]

-- | See mkYesodData.
mkYesodDispatch :: String -> [ResourceTree String] -> Q [Dec]

-- | See mkYesodDataOpts
mkYesodDispatchOpts :: RouteOpts -> String -> [ResourceTree String] -> Q [Dec]
mkYesodSubDispatch :: [ResourceTree a] -> Q Exp

-- | General opts data type for generating yesod.
--   
--   Contains options for customizing code generation for the router in
--   mkYesodData, including what type class instances will be
--   derived for the route datatype, whether to parameterize subroutes, and
--   whether or not to create the resources :: [ResourceTree
--   String] value. Use the setting functions on defaultOpts to
--   set specific fields.
data RouteOpts

-- | Default options for generating routes.
--   
--   Defaults to all instances derived, subroutes being unparameterized,
--   and to create the resourcesSite :: [ResourceTree String]
--   term.
defaultOpts :: RouteOpts

setEqDerived :: Bool -> RouteOpts -> RouteOpts

setShowDerived :: Bool -> RouteOpts -> RouteOpts

setReadDerived :: Bool -> RouteOpts -> RouteOpts

-- | Determine whether or not to generate the resourcesApp value.
--   
--   Disabling this can be useful if you are creating the routes ::
--   [ResourceTree String] elsewhere in your module, and referring to
--   it here. The resourcesApp can become very large in large
--   applications, and duplicating it can result in signifiacntly higher
--   compile times.
setCreateResources :: Bool -> RouteOpts -> RouteOpts

-- | If True, we will correctly pass parameters for subroutes around.
setParameterizedSubroute :: Bool -> RouteOpts -> RouteOpts

-- | Generate a random number uniformly distributed in the full range of
--   Int.
--   
--   Note: Before 1.6.20, this generates pseudo-random number in an
--   unspecified range. The range size may not be a power of 2. Since
--   1.6.20, this uses a secure entropy source and generates in the full
--   range of Int.
defaultGen :: IO Int

-- | Default constructor for yreGetMaxExpires field. Low level
--   function for simple manual construction of YesodRunnerEnv.
getGetMaxExpires :: IO (IO Text)
class PathPiece s
fromPathPiece :: PathPiece s => Text -> Maybe s
toPathPiece :: PathPiece s => s -> Text
class PathMultiPiece s
fromPathMultiPiece :: PathMultiPiece s => [Text] -> Maybe s
toPathMultiPiece :: PathMultiPiece s => s -> [Text]
type Texts = [Text]

-- | Same as toWaiAppPlain, but provides a default set of
--   middlewares. This set may change with future releases, but currently
--   covers:
--   
--   
--   
- Logging
--   
- GZIP compression
--   
- Automatic HEAD method handling
--   
- Request method override with the _method query string
--   parameter
--   
- Accept header override with the _accept query string
--   parameter
--   
toWaiApp :: YesodDispatch site => site -> IO Application

-- | Convert the given argument into a WAI application, executable with any
--   WAI handler. This function will provide no middlewares; if you want
--   commonly used middlewares, please use toWaiApp.
toWaiAppPlain :: YesodDispatch site => site -> IO Application

-- | Pure low level function to construct WAI application. Usefull when you
--   need not standard way to run your app, or want to embed it inside
--   another app.
toWaiAppYre :: YesodDispatch site => YesodRunnerEnv site -> Application

-- | A convenience method to run an application using the Warp webserver on
--   the specified port. Automatically calls toWaiApp. Provides a
--   default set of middlewares. This set may change at any point without a
--   breaking version number. Currently, it includes:
--   
--   
--   
- Logging
--   
- GZIP compression
--   
- Automatic HEAD method handling
--   
- Request method override with the _method query string
--   parameter
--   
- Accept header override with the _accept query string
--   parameter
--   
--   
--   If you need more fine-grained control of middlewares, please use
--   toWaiApp directly.
--   
--   Since 1.2.0
warp :: YesodDispatch site => Int -> site -> IO ()

-- | Deprecated synonym for warp.

-- | Deprecated: Please use warp instead
warpDebug :: YesodDispatch site => Int -> site -> IO ()

-- | Runs your application using default middlewares (i.e., via
--   toWaiApp). It reads port information from the PORT environment
--   variable, as used by tools such as Keter and the FP Complete School of
--   Haskell.
--   
--   Note that the exact behavior of this function may be modified slightly
--   over time to work correctly with external tools, without a change to
--   the type signature.
warpEnv :: YesodDispatch site => site -> IO ()

-- | A default set of middlewares.
--   
--   Since 1.2.0
mkDefaultMiddlewares :: Logger -> IO Middleware

-- | All of the default middlewares, excluding logging.
--   
--   Since 1.2.12
defaultMiddlewaresNoLogging :: Middleware

-- | Wrap up a normal WAI application as a Yesod subsite. Ignore parent
--   site's middleware and isAuthorized.
newtype WaiSubsite
WaiSubsite :: Application -> WaiSubsite
[runWaiSubsite] :: WaiSubsite -> Application

-- | Like WaiSubsite, but applies parent site's middleware and
--   isAuthorized.
newtype WaiSubsiteWithAuth
WaiSubsiteWithAuth :: Application -> WaiSubsiteWithAuth
[runWaiSubsiteWithAuth] :: WaiSubsiteWithAuth -> Application

module Yesod.Core

-- | Define settings for a Yesod applications. All methods have intelligent
--   defaults, and therefore no implementation is required.
class RenderRoute site => Yesod site

-- | 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.
approot :: Yesod site => Approot site

-- | 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.
catchHandlerExceptions :: (Yesod site, MonadUnliftIO m) => site -> m a -> (SomeException -> m a) -> m a

-- | Output error response pages.
--   
--   Default value: defaultErrorHandler.
errorHandler :: Yesod site => ErrorResponse -> HandlerFor site TypedContent

-- | Applies some form of layout to the contents of a page.
defaultLayout :: Yesod site => WidgetFor site () -> HandlerFor site Html

-- | 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
urlParamRenderOverride :: Yesod site => site -> Route site -> [(Text, Text)] -> Maybe Builder

-- | 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.
isAuthorized :: Yesod site => Route site -> Bool -> HandlerFor site AuthResult

-- | 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.
isWriteRequest :: Yesod site => Route site -> HandlerFor site Bool

-- | The default route for authentication.
--   
--   Used in particular by isAuthorized, but library users can do
--   whatever they want with it.
authRoute :: Yesod site => site -> Maybe (Route site)

-- | 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.
cleanPath :: Yesod site => site -> [Text] -> Either [Text] [Text]

-- | 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.
joinPath :: Yesod site => site -> Text -> [Text] -> [(Text, Text)] -> Builder

-- | 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.
addStaticContent :: Yesod site => Text -> Text -> ByteString -> HandlerFor site (Maybe (Either Text (Route site, [(Text, Text)])))

-- | 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.
maximumContentLength :: Yesod site => site -> Maybe (Route site) -> Maybe Word64

-- | 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.
maximumContentLengthIO :: Yesod site => site -> Maybe (Route site) -> IO (Maybe Word64)

-- | 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.
makeLogger :: Yesod site => site -> IO Logger

-- | Send a message to the Logger provided by getLogger.
--   
--   Default: the defaultMessageLoggerSource function, using
--   shouldLogIO to check whether we should log.
messageLoggerSource :: Yesod site => site -> Logger -> Loc -> LogSource -> LogLevel -> LogStr -> IO ()

-- | Where to Load sripts from. We recommend the default value,
--   BottomOfBody.
jsLoader :: Yesod site => site -> ScriptLoadPosition site

-- | Default attributes to put on the JavaScript script tag
--   generated for julius files
jsAttributes :: Yesod site => site -> [(Text, Text)]

-- | 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.
jsAttributesHandler :: Yesod site => HandlerFor site [(Text, Text)]

-- | 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.
makeSessionBackend :: Yesod site => site -> IO (Maybe SessionBackend)

-- | 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.
fileUpload :: Yesod site => site -> RequestBodyLength -> FileUpload

-- | Should we log the given log source/level combination.
--   
--   Default: the defaultShouldLogIO function.
--   
--   Since 1.2.4
shouldLogIO :: Yesod site => site -> LogSource -> LogLevel -> IO Bool

-- | 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
yesodMiddleware :: (Yesod site, ToTypedContent res) => HandlerFor site res -> HandlerFor site res

-- | 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
yesodWithInternalState :: Yesod site => site -> Maybe (Route site) -> (InternalState -> IO a) -> IO a

-- | Convert a title and HTML snippet into a Widget. Used
--   primarily for wrapping up error messages for better display.
defaultMessageWidget :: Yesod site => Html -> HtmlUrl (Route site) -> WidgetFor site ()

-- | This class is automatically instantiated when you use the template
--   haskell mkYesod function. You should never need to deal with it
--   directly.
class Yesod site => YesodDispatch site
yesodDispatch :: YesodDispatch site => YesodRunnerEnv site -> Application
class YesodSubDispatch sub master
yesodSubDispatch :: YesodSubDispatch sub master => YesodSubRunnerEnv sub master -> Application
class Eq Route a => RenderRoute a where {
    
    -- | The <a>type-safe URLs</a> associated with a site argument.
    data Route a;
}
renderRoute :: RenderRoute a => Route a -> ([Text], [(Text, Text)])
class RenderRoute a => ParseRoute a
parseRoute :: ParseRoute a => ([Text], [(Text, Text)]) -> Maybe (Route a)
class RenderRoute a => RouteAttrs a
routeAttrs :: RouteAttrs a => Route a -> Set Text

-- | 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).
class YesodBreadcrumbs site

-- | Returns the title and the parent resource, if available. If you return
--   a Nothing, then this is considered a top-level page.
breadcrumb :: YesodBreadcrumbs site => Route site -> HandlerFor site (Text, Maybe (Route site))

-- | Gets the title of the current page and the hierarchy of parent pages,
--   along with their respective titles.
breadcrumbs :: (YesodBreadcrumbs site, Show (Route site), Eq (Route site)) => HandlerFor site (Text, [(Route site, Text)])

-- | 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.
data Approot master

-- | No application root.
ApprootRelative :: Approot master
ApprootStatic :: !Text -> Approot master
ApprootMaster :: !master -> Text -> Approot master
ApprootRequest :: !master -> Request -> Text -> Approot master
data FileUpload
FileUploadMemory :: !BackEnd ByteString -> FileUpload
FileUploadDisk :: !InternalState -> BackEnd FilePath -> FileUpload
FileUploadSource :: !BackEnd (ConduitT () ByteString (ResourceT IO) ()) -> FileUpload

-- | Responses to indicate some form of an error occurred.
data ErrorResponse

-- | 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.
NotFound :: ErrorResponse

-- | 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.
InternalError :: !Text -> ErrorResponse

-- | 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.
InvalidArgs :: ![Text] -> ErrorResponse

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

-- | Indicates the user doesn't have permission to access the requested
--   resource. This is thrown when isAuthorized returns
--   Unauthorized. HTTP code: 403.
PermissionDenied :: !Text -> ErrorResponse

-- | 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.
BadMethod :: !Method -> ErrorResponse

-- | 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.
maybeAuthorized :: Yesod site => Route site -> Bool -> HandlerT site IO (Maybe (Route site))

-- | Convert a widget to a PageContent.
widgetToPageContent :: Yesod site => WidgetFor site () -> HandlerFor site (PageContent (Route site))

-- | The default error handler for errorHandler.
defaultErrorHandler :: Yesod site => ErrorResponse -> HandlerFor site TypedContent

-- | 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
defaultYesodMiddleware :: Yesod site => HandlerFor site res -> HandlerFor site res

-- | Check if a given request is authorized via isAuthorized and
--   isWriteRequest.
--   
--   Since 1.2.0
authorizationCheck :: Yesod site => HandlerFor site ()
data AuthResult
Authorized :: AuthResult
AuthenticationRequired :: AuthResult
Unauthorized :: !Text -> AuthResult

-- | Return an Unauthorized value, with the given i18n message.
unauthorizedI :: (MonadHandler m, RenderMessage (HandlerSite m) msg) => msg -> m AuthResult

-- | Default implementation of makeLogger. Sends to stdout and
--   automatically flushes on each write.
--   
--   Since 1.4.10
defaultMakeLogger :: IO Logger

-- | 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
defaultMessageLoggerSource :: (LogSource -> LogLevel -> IO Bool) -> Logger -> Loc -> LogSource -> LogLevel -> LogStr -> IO ()

-- | Default implementation of shouldLog. Logs everything at or
--   above LevelInfo.
--   
--   Since 1.4.10
defaultShouldLogIO :: LogSource -> LogLevel -> IO Bool

-- | 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
formatLogMessage :: IO ZonedDate -> Loc -> LogSource -> LogLevel -> LogStr -> IO LogStr
data LogLevel
LevelDebug :: LogLevel
LevelInfo :: LogLevel
LevelWarn :: LogLevel
LevelError :: LogLevel
LevelOther :: Text -> LogLevel

-- | Generates a function that takes a Text and logs a
--   LevelDebug message. Usage:
--   
--   
--   $(logDebug) "This is a debug log message"
--   
logDebug :: Q Exp

-- | See logDebug
logInfo :: Q Exp

-- | See logDebug
logWarn :: Q Exp

-- | See logDebug
logError :: Q Exp

-- | Generates a function that takes a Text and logs a
--   LevelOther message. Usage:
--   
--   
--   $(logOther "My new level") "This is a log message"
--   
logOther :: Text -> Q Exp

-- | Generates a function that takes a LogSource and Text and
--   logs a LevelDebug message. Usage:
--   
--   
--   $logDebugS "SomeSource" "This is a debug log message"
--   
logDebugS :: Q Exp

-- | See logDebugS
logInfoS :: Q Exp

-- | See logDebugS
logWarnS :: Q Exp

-- | See logDebugS
logErrorS :: Q Exp

-- | Generates a function that takes a LogSource, a level name and a
--   Text and logs a LevelOther message. Usage:
--   
--   
--   $logOtherS "SomeSource" "My new level" "This is a log message"
--   
logOtherS :: Q Exp
newtype SessionBackend
SessionBackend :: (Request -> IO (SessionMap, SaveSession)) -> SessionBackend

-- | Return the session data and a function to save the session
[sbLoadSession] :: SessionBackend -> Request -> IO (SessionMap, SaveSession)

-- | 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).
customizeSessionCookies :: (SetCookie -> SetCookie) -> SessionBackend -> SessionBackend
defaultClientSessionBackend :: Int -> FilePath -> IO SessionBackend

-- | Create a SessionBackend which reads the session key from the
--   named environment variable.
--   
--   This can be useful if:
--   
--   
--   
- You can't rely on a persistent file system (e.g. Heroku)
--   
- 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:
--   
--   
--   
- Run this code without the variable set, a value will be generated
--   and printed on devstdout/
--   
- Use clientsession-generate
--   
--   
--   Since 1.4.5
envClientSessionBackend :: Int -> String -> IO SessionBackend
clientSessionBackend :: Key -> IO ClientSessionDateCache -> SessionBackend

-- | 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
sslOnlySessions :: IO (Maybe SessionBackend) -> IO (Maybe SessionBackend)

-- | 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.
laxSameSiteSessions :: IO (Maybe SessionBackend) -> IO (Maybe SessionBackend)

-- | 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.
strictSameSiteSessions :: IO (Maybe SessionBackend) -> IO (Maybe SessionBackend)

-- | 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
sslOnlyMiddleware :: Int -> HandlerFor site res -> HandlerFor site res
clientSessionDateCacher :: NominalDiffTime -> IO (IO ClientSessionDateCache, IO ())
loadClientSession :: Key -> IO ClientSessionDateCache -> ByteString -> Request -> IO (SessionMap, SaveSession)

-- | Headers to be added to a Result.
data Header
AddCookie :: !SetCookie -> Header

-- | name and path
DeleteCookie :: !ByteString -> !ByteString -> Header

-- | key and value
Header :: !CI ByteString -> !ByteString -> Header

-- | 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
defaultCsrfMiddleware :: Yesod site => HandlerFor site res -> HandlerFor site res

-- | Calls csrfSetCookieMiddleware with the
--   defaultCsrfCookieName.
--   
--   The cookie's path is set to /, making it valid for your whole
--   website.
--   
--   Since 1.4.14
defaultCsrfSetCookieMiddleware :: HandlerFor site res -> HandlerFor site res

-- | 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
csrfSetCookieMiddleware :: HandlerFor site res -> SetCookie -> HandlerFor site res

-- | Calls csrfCheckMiddleware with isWriteRequest,
--   defaultCsrfHeaderName, and defaultCsrfParamName as
--   parameters.
--   
--   Since 1.4.14
defaultCsrfCheckMiddleware :: Yesod site => HandlerFor site res -> 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
csrfCheckMiddleware :: HandlerFor site res -> HandlerFor site Bool -> CI ByteString -> Text -> HandlerFor site res
data ScriptLoadPosition master
BottomOfBody :: ScriptLoadPosition master
BottomOfHeadBlocking :: ScriptLoadPosition master
BottomOfHeadAsync :: !BottomOfHeadAsync master -> ScriptLoadPosition master
type BottomOfHeadAsync master = [Text] -> Maybe HtmlUrl Route master -> HtmlUrl Route master
class (MonadResource m, MonadLogger m) => MonadHandler (m :: Type -> Type) where {
    type HandlerSite (m :: Type -> Type);
    type SubHandlerSite (m :: Type -> Type);
}
liftHandler :: MonadHandler m => HandlerFor (HandlerSite m) a -> m a
liftSubHandler :: MonadHandler m => SubHandlerFor (SubHandlerSite m) (HandlerSite m) a -> m a
class MonadHandler m => MonadWidget (m :: Type -> Type)
liftWidget :: MonadWidget m => WidgetFor (HandlerSite m) a -> m a

-- | 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
guessApproot :: Approot site

-- | Guess the approot based on request headers, with fall back to the
--   specified AppRoot.
--   
--   Since 1.4.16
guessApprootOr :: Approot site -> Approot site

-- | Get the textual application root from an Approot value.
--   
--   Since 1.4.17
getApprootText :: Approot site -> site -> Request -> Text
yesodVersion :: String
yesodRender :: Yesod y => y -> ResolvedApproot -> Route y -> [(Text, Text)] -> Text

-- | Deprecated: import runFakeHandler from Yesod.Core.Unsafe
runFakeHandler :: (Yesod site, MonadIO m) => SessionMap -> (site -> Logger) -> site -> HandlerT site IO a -> m (Either ErrorResponse a)
newtype LiteApp
LiteApp :: (Method -> [Text] -> Maybe (LiteHandler TypedContent)) -> LiteApp
[unLiteApp] :: LiteApp -> Method -> [Text] -> Maybe (LiteHandler TypedContent)

-- | The type-safe URLs associated with a site argument.
data family Route a

-- | The type-safe URLs associated with a site argument.
data family Route a
type LiteHandler = HandlerFor LiteApp
type LiteWidget = WidgetFor LiteApp
liteApp :: Writer LiteApp () -> LiteApp
dispatchTo :: ToTypedContent a => LiteHandler a -> Writer LiteApp ()
onMethod :: Method -> Writer LiteApp () -> Writer LiteApp ()
onStatic :: Text -> Writer LiteApp () -> Writer LiteApp ()
withDynamic :: PathPiece p => (p -> Writer LiteApp ()) -> Writer LiteApp ()
withDynamicMulti :: PathMultiPiece ps => (ps -> Writer LiteApp ()) -> Writer LiteApp ()
yesodRunner :: (ToTypedContent res, Yesod site) => HandlerFor site res -> YesodRunnerEnv site -> Maybe (Route site) -> Application

-- | Format a UTCTime in W3 format.
formatW3 :: UTCTime -> Text

-- | Format as per RFC 1123.
formatRFC1123 :: UTCTime -> Text

-- | Format as per RFC 822.
formatRFC822 :: UTCTime -> Text
type Html = Markup
toHtml :: ToMarkup a => a -> Html

-- | Convert a value to Markup without escaping
preEscapedToMarkup :: ToMarkup a => a -> Markup

-- | The class of monad transformers. For any monad m, the result
--   t m should also be a monad, and lift should be a monad
--   transformation from m to t m, i.e. it should satisfy
--   the following laws:
--   
--   
--   
- 
lift . return = return

--   
- 
lift (m >>= f) = lift m >>=
--   (lift . f)

--   
--   
--   Since 0.6.0.0 and for GHC 8.6 and later, the requirement that t
--   m be a Monad is enforced by the implication constraint
--   forall m. Monad m => Monad (t m) enabled by
--   the QuantifiedConstraints extension.
--   
--   
Ambiguity error with GHC 9.0 to 9.2.2
--   
--   These versions of GHC have a bug
--   (https://gitlab.haskell.org/ghc/ghc/-/issues/20582) which
--   causes constraints like
--   
--   
--   (MonadTrans t, forall m. Monad m => Monad (t m)) => ...
--   
--   
--   to be reported as ambiguous. For transformers 0.6 and later, this can
--   be fixed by removing the second constraint, which is implied by the
--   first.
class forall (m :: Type -> Type). Monad m => Monad t m => MonadTrans (t :: Type -> Type -> Type -> Type)

-- | Lift a computation from the argument monad to the constructed monad.
lift :: (MonadTrans t, Monad m) => m a -> t m a

-- | Monads in which IO computations may be embedded. Any monad
--   built by applying a sequence of monad transformers to the IO
--   monad will be an instance of this class.
--   
--   Instances should satisfy the following laws, which state that
--   liftIO is a transformer of monads:
--   
--   
--   
- 
liftIO . return = return

--   
- 
liftIO (m >>= f) = liftIO m >>=
--   (liftIO . f)

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

-- | Lift a computation from the IO monad. This allows us to run IO
--   computations in any monadic stack, so long as it supports these kinds
--   of operations (i.e. IO is the base monad for the stack).
--   
--   
Example
--   
--   
--   import Control.Monad.Trans.State -- from the "transformers" library
--   
--   printState :: Show s => StateT s IO ()
--   printState = do
--     state <- get
--     liftIO $ print state
--   
--   
--   Had we omitted liftIO, we would have ended up with
--   this error:
--   
--   
--   • Couldn't match type ‘IO’ with ‘StateT s IO’
--    Expected type: StateT s IO ()
--      Actual type: IO ()
--   
--   
--   The important part here is the mismatch between StateT s IO
--   () and IO ().
--   
--   Luckily, we know of a function that takes an IO a and
--   returns an (m a): liftIO, enabling us to run
--   the program and see the expected results:
--   
--   
--   > evalStateT printState "hello"
--   "hello"
--   
--   > evalStateT printState 3
--   3
--   
liftIO :: MonadIO m => IO a -> m a
class MonadIO m => MonadUnliftIO (m :: Type -> Type)
withRunInIO :: MonadUnliftIO m => ((forall a. () => m a -> IO a) -> IO b) -> m b

-- | A Monad which allows for safe resource allocation. In theory,
--   any monad transformer stack which includes a ResourceT can be
--   an instance of MonadResource.
--   
--   Note: runResourceT has a requirement for a MonadUnliftIO
--   m monad, which allows control operations to be lifted. A
--   MonadResource does not have this requirement. This means that
--   transformers such as ContT can be an instance of
--   MonadResource. However, the ContT wrapper will need
--   to be unwrapped before calling runResourceT.
--   
--   Since 0.3.0
class MonadIO m => MonadResource (m :: Type -> Type)

-- | Lift a ResourceT IO action into the current Monad.
--   
--   Since 0.4.0
liftResourceT :: MonadResource m => ResourceT IO a -> m a

-- | A Monad which has the ability to log messages in some manner.
class Monad m => MonadLogger (m :: Type -> Type)

-- | The WAI application.
--   
--   Note that, since WAI 3.0, this type is structured in continuation
--   passing style to allow for proper safe resource handling. This was
--   handled in the past via other means (e.g., ResourceT). As a
--   demonstration:
--   
--   
--   app :: Application
--   app req respond = bracket_
--       (putStrLn "Allocating scarce resource")
--       (putStrLn "Cleaning up")
--       (respond $ responseLBS status200 [] "Hello World")
--   
type Application = Request -> Response -> IO ResponseReceived -> IO ResponseReceived
showIntegral :: Integral a => a -> String
readIntegral :: Num a => String -> Maybe a

-- | Hamlet quasi-quoter. May only be used to generate expressions.
--   
--   Generated expression have type HtmlUrl url, for some
--   url.
--   
--   
--   data MyRoute = Home
--   
--   render :: Render MyRoute
--   render Home _ = "/home"
--   
--   >>> putStrLn (renderHtml ([hamlet|<a href=@{Home}>Home|] render))
--   <a href="/home">Home</a>
--   
hamlet :: QuasiQuoter

-- | "Simple Hamlet" quasi-quoter. May only be used to generate
--   expressions.
--   
--   Generated expressions have type Html.
--   
--   
--   >>> putStrLn (renderHtml [shamlet|<div>Hello, world!|])
--   <div>Hello, world!</div>
--   
shamlet :: QuasiQuoter

-- | Like hamlet, but produces XHTML.
xhamlet :: QuasiQuoter

-- | A function generating an Html given a URL-rendering function.
type HtmlUrl url = Render url -> Html
julius :: QuasiQuoter

-- | Return type of template-reading functions.
type JavascriptUrl url = url -> [(Text, Text)] -> Text -> Javascript

-- | render with route interpolation. If using this module standalone,
--   apart from type-safe routes, a dummy renderer can be used:
--   
--   
--   renderJavascriptUrl (\_ _ -> undefined) javascriptUrl
--   
--   
--   When using Yesod, a renderer is generated for you, which can be
--   accessed within the GHandler monad: getUrlRenderParams.
renderJavascriptUrl :: (url -> [(Text, Text)] -> Text) -> JavascriptUrl url -> Text
cassius :: QuasiQuoter

-- | 
--   >>> renderCss ([lucius|foo{bar:baz}|] undefined)
--   "foo{bar:baz}"
--   
lucius :: QuasiQuoter
type CssUrl url = url -> [(Text, Text)] -> Text -> Css
renderCssUrl :: (url -> [(Text, Text)] -> Text) -> CssUrl url -> Text
