| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Yesod.Core.Types
Contents
Synopsis
- data Location url
- data Header
- newtype Body url = Body (HtmlUrl url)
- data FileInfo = FileInfo {
- fileName :: !Text
- fileContentType :: !Text
- fileSourceRaw :: !(ConduitT () ByteString (ResourceT IO) ())
- fileMove :: !(FilePath -> IO ())
- data Logger = Logger {}
- data Approot master
- = ApprootRelative
- | ApprootStatic !Text
- | ApprootMaster !(master -> Text)
- | ApprootRequest !(master -> Request -> Text)
- data FileUpload
- = FileUploadMemory !(BackEnd ByteString)
- | FileUploadDisk !(InternalState -> BackEnd FilePath)
- | FileUploadSource !(BackEnd (ConduitT () ByteString (ResourceT IO) ()))
- data AuthResult
- newtype SessionBackend = SessionBackend {
- sbLoadSession :: Request -> IO (SessionMap, SaveSession)
- data ScriptLoadPosition master
- = BottomOfBody
- | BottomOfHeadBlocking
- | BottomOfHeadAsync !(BottomOfHeadAsync master)
- type BottomOfHeadAsync master = [Text] -> Maybe (HtmlUrl (Route master)) -> HtmlUrl (Route master)
- newtype DontFullyEvaluate a = DontFullyEvaluate {
- unDontFullyEvaluate :: a
- type RepHtml = Html
- newtype RepJson = RepJson Content
- newtype RepPlain = RepPlain Content
- newtype RepXml = RepXml Content
- type Texts = [Text]
- newtype WaiSubsite = WaiSubsite {}
- newtype WaiSubsiteWithAuth = WaiSubsiteWithAuth {}
- newtype HandlerFor site a = HandlerFor {
- unHandlerFor :: HandlerData site site -> IO a
- type RequestBodyContents = ([(Text, Text)], [(Text, FileInfo)])
- data YesodRequest = YesodRequest {
- reqGetParams :: ![(Text, Text)]
- reqCookies :: ![(Text, Text)]
- reqWaiRequest :: !Request
- reqLangs :: ![Text]
- reqToken :: !(Maybe Text)
- reqSession :: !SessionMap
- reqAccept :: ![ContentType]
- type SessionMap = Map Text ByteString
- newtype SubHandlerFor sub master a = SubHandlerFor {
- unSubHandlerFor :: HandlerData sub master -> IO a
- newtype WidgetFor site a = WidgetFor {
- unWidgetFor :: WidgetData site -> IO a
- data PageContent url = PageContent {}
- newtype CssBuilder = CssBuilder {}
- data ClientSessionDateCache = ClientSessionDateCache {}
- type SaveSession = SessionMap -> IO [Header]
- data SessionCookie = SessionCookie !(Either UTCTime ByteString) !ByteString !SessionMap
- data YesodResponse
- = YRWai !Response
- | YRWaiApp !Application
- | YRPlain !Status ![Header] !ContentType !Content !SessionMap
- type ResolvedApproot = Text
- data RunHandlerEnv child site = RunHandlerEnv {
- rheRender :: !(Route site -> [(Text, Text)] -> Text)
- rheRoute :: !(Maybe (Route child))
- rheRouteToMaster :: !(Route child -> Route site)
- rheSite :: !site
- rheChild :: !child
- rheUpload :: !(RequestBodyLength -> FileUpload)
- rheLog :: !(Loc -> LogSource -> LogLevel -> LogStr -> IO ())
- rheOnError :: !(ErrorResponse -> YesodApp)
- rheMaxExpires :: !Text
- rheCatchHandlerExceptions :: !(forall a (m :: Type -> Type). MonadUnliftIO m => m a -> (SomeException -> m a) -> m a)
- type YesodApp = YesodRequest -> ResourceT IO YesodResponse
- data HandlerData child site = HandlerData {
- handlerRequest :: !YesodRequest
- handlerEnv :: !(RunHandlerEnv child site)
- handlerState :: !(IORef GHState)
- handlerResource :: !InternalState
- data GHState = GHState {
- ghsSession :: !SessionMap
- ghsRBC :: !(Maybe RequestBodyContents)
- ghsIdent :: !Int
- ghsCache :: !TypeMap
- ghsCacheBy :: !KeyedTypeMap
- ghsHeaders :: !(Endo [Header])
- data YesodRunnerEnv site = YesodRunnerEnv {
- yreLogger :: !Logger
- yreSite :: !site
- yreSessionBackend :: !(Maybe SessionBackend)
- yreGen :: !(IO Int)
- yreGetMaxExpires :: !(IO Text)
- data YesodSubRunnerEnv sub parent = YesodSubRunnerEnv {
- ysreParentRunner :: !(ParentRunner parent)
- ysreGetSub :: !(parent -> sub)
- ysreToParentRoute :: !(Route sub -> Route parent)
- ysreParentEnv :: !(YesodRunnerEnv parent)
- type ParentRunner parent = HandlerFor parent TypedContent -> YesodRunnerEnv parent -> Maybe (Route parent) -> Application
- data WidgetData site = WidgetData {}
- data GWData a = GWData {
- gwdBody :: !(Body a)
- gwdTitle :: !(Last Title)
- gwdDescription :: !(Last Description)
- gwdScripts :: !(UniqueList (Script a))
- gwdStylesheets :: !(UniqueList (Stylesheet a))
- gwdCss :: !(Map (Maybe Text) (CssBuilderUrl a))
- gwdJavascript :: !(Maybe (JavascriptUrl a))
- gwdHead :: !(Head a)
- tellWidget :: GWData (Route site) -> WidgetFor site ()
- type RY master = Route master -> [(Text, Text)] -> Text
- data JSONResponse a where
- JSONResponse :: forall a. ToJSON a => a -> JSONResponse a
- newtype UniqueList x = UniqueList ([x] -> [x])
- data Script url = Script {
- scriptLocation :: !(Location url)
- scriptAttributes :: ![(Text, Text)]
- data Stylesheet url = Stylesheet {
- styleLocation :: !(Location url)
- styleAttributes :: ![(Text, Text)]
- newtype Title = Title {}
- newtype Description = Description {}
- newtype Head url = Head (HtmlUrl url)
- type CssBuilderUrl a = (a -> [(Text, Text)] -> Text) -> Builder
- WaiSubsiteRoute :: [Text] %1 -> [(Text, Text)] %1 -> Route WaiSubsite
- WaiSubsiteWithAuthRoute :: [Text] %1 -> [(Text, Text)] %1 -> Route WaiSubsiteWithAuth
- loggerPutStr :: Logger -> LogStr -> IO ()
- data ErrorResponse
- data Content
- = ContentBuilder !Builder !(Maybe Int)
- | ContentSource !(ConduitT () (Flush Builder) (ResourceT IO) ())
- | ContentFile !FilePath !(Maybe FilePart)
- | ContentDontEvaluate !Content
- type ContentType = ByteString
- typedContentToSnippet :: TypedContent -> Int64 -> Maybe Text
- data TypedContent = TypedContent !ContentType !Content
- data HandlerContents
- = HCContent !Status !TypedContent
- | HCError !ErrorResponse
- | HCSendFile !ContentType !FilePath !(Maybe FilePart)
- | HCRedirect !Status !Text
- | HCCreated !Text
- | HCWai !Response
- | HCWaiApp !Application
- getTime :: Get UTCTime
- putTime :: UTCTime -> Put
- class Eq (Route a) => RenderRoute a where
- class RenderRoute a => ParseRoute a where
- data family Route a
- type TypeMap = HashMap TypeRep Dynamic
- type KeyedTypeMap = HashMap (TypeRep, ByteString) Dynamic
Documentation
Headers to be added to a Result.
Constructors
| AddCookie !SetCookie | |
| DeleteCookie !ByteString !ByteString | name and path |
| Header !(CI ByteString) !ByteString | key and value |
Constructors
| FileInfo | |
Fields
| |
Constructors
| Logger | |
Fields
| |
How to determine the root of the application for constructing URLs.
Note that future versions of Yesod may add new constructors without bumping
the major version number. As a result, you should not pattern match on
Approot values.
Constructors
| ApprootRelative | No application root. |
| ApprootStatic !Text | |
| ApprootMaster !(master -> Text) | |
| ApprootRequest !(master -> Request -> Text) |
data FileUpload Source #
Constructors
| FileUploadMemory !(BackEnd ByteString) | |
| FileUploadDisk !(InternalState -> BackEnd FilePath) | |
| FileUploadSource !(BackEnd (ConduitT () ByteString (ResourceT IO) ())) |
data AuthResult Source #
Constructors
| Authorized | |
| AuthenticationRequired | |
| Unauthorized !Text |
Instances
| Read AuthResult Source # | |
Defined in Yesod.Core.Types Methods readsPrec :: Int -> ReadS AuthResult # readList :: ReadS [AuthResult] # readPrec :: ReadPrec AuthResult # readListPrec :: ReadPrec [AuthResult] # | |
| Show AuthResult Source # | |
Defined in Yesod.Core.Types Methods showsPrec :: Int -> AuthResult -> ShowS # show :: AuthResult -> String # showList :: [AuthResult] -> ShowS # | |
| Eq AuthResult Source # | |
Defined in Yesod.Core.Types | |
newtype SessionBackend Source #
Constructors
| SessionBackend | |
Fields
| |
data ScriptLoadPosition master Source #
Constructors
| BottomOfBody | |
| BottomOfHeadBlocking | |
| BottomOfHeadAsync !(BottomOfHeadAsync master) |
type BottomOfHeadAsync master Source #
newtype DontFullyEvaluate a Source #
Prevents a response body from being fully evaluated before sending the request.
Since 1.1.0
Constructors
| DontFullyEvaluate | |
Fields
| |
Instances
| HasContentType a => HasContentType (DontFullyEvaluate a) Source # | |
Defined in Yesod.Core.Content Methods getContentType :: Monad m => m (DontFullyEvaluate a) -> ContentType Source # | |
| ToContent a => ToContent (DontFullyEvaluate a) Source # | |
Defined in Yesod.Core.Content Methods toContent :: DontFullyEvaluate a -> Content Source # | |
| ToTypedContent a => ToTypedContent (DontFullyEvaluate a) Source # | |
Defined in Yesod.Core.Content Methods toTypedContent :: DontFullyEvaluate a -> TypedContent Source # | |
Instances
| HasContentType RepJson Source # | |
Defined in Yesod.Core.Content Methods getContentType :: Monad m => m RepJson -> ContentType Source # | |
| ToContent RepJson Source # | |
| ToTypedContent RepJson Source # | |
Defined in Yesod.Core.Content Methods toTypedContent :: RepJson -> TypedContent Source # | |
Instances
| HasContentType RepPlain Source # | |
Defined in Yesod.Core.Content Methods getContentType :: Monad m => m RepPlain -> ContentType Source # | |
| ToContent RepPlain Source # | |
| ToTypedContent RepPlain Source # | |
Defined in Yesod.Core.Content Methods | |
Instances
| HasContentType RepXml Source # | |
Defined in Yesod.Core.Content Methods getContentType :: Monad m => m RepXml -> ContentType Source # | |
| ToContent RepXml Source # | |
| ToTypedContent RepXml Source # | |
Defined in Yesod.Core.Content Methods toTypedContent :: RepXml -> TypedContent Source # | |
newtype WaiSubsite Source #
Wrap up a normal WAI application as a Yesod subsite. Ignore parent site's middleware and isAuthorized.
Constructors
| WaiSubsite | |
Fields | |
Instances
newtype WaiSubsiteWithAuth Source #
Like WaiSubsite, but applies parent site's middleware and isAuthorized.
Since: 1.4.34
Constructors
| WaiSubsiteWithAuth | |
Fields | |
Instances
| ParseRoute WaiSubsiteWithAuth Source # | |||||
Defined in Yesod.Core.Types Methods parseRoute :: ([Text], [(Text, Text)]) -> Maybe (Route WaiSubsiteWithAuth) Source # | |||||
| RenderRoute WaiSubsiteWithAuth Source # | |||||
Defined in Yesod.Core.Types Associated Types
Methods renderRoute :: Route WaiSubsiteWithAuth -> ([Text], [(Text, Text)]) Source # | |||||
| YesodSubDispatch WaiSubsiteWithAuth master Source # | |||||
Defined in Yesod.Core.Class.Dispatch Methods yesodSubDispatch :: YesodSubRunnerEnv WaiSubsiteWithAuth master -> Application Source # | |||||
| Read (Route WaiSubsiteWithAuth) Source # | |||||
Defined in Yesod.Core.Types | |||||
| Show (Route WaiSubsiteWithAuth) Source # | |||||
Defined in Yesod.Core.Types | |||||
| Eq (Route WaiSubsiteWithAuth) Source # | |||||
Defined in Yesod.Core.Types Methods (==) :: Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth -> Bool # (/=) :: Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth -> Bool # | |||||
| Ord (Route WaiSubsiteWithAuth) Source # | |||||
Defined in Yesod.Core.Types Methods compare :: Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth -> Ordering # (<) :: Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth -> Bool # (<=) :: Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth -> Bool # (>) :: Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth -> Bool # (>=) :: Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth -> Bool # max :: Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth # min :: Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth # | |||||
| data Route WaiSubsiteWithAuth Source # | |||||
Defined in Yesod.Core.Types | |||||
newtype HandlerFor site a Source #
A generic handler monad, which can have a different subsite and master site. We define a newtype for better error message.
Constructors
| HandlerFor | |
Fields
| |
Instances
| MonadIO (HandlerFor site) Source # | |||||||||
Defined in Yesod.Core.Types Methods liftIO :: IO a -> HandlerFor site a # | |||||||||
| Applicative (HandlerFor site) Source # | |||||||||
Defined in Yesod.Core.Types Methods pure :: a -> HandlerFor site a # (<*>) :: HandlerFor site (a -> b) -> HandlerFor site a -> HandlerFor site b # liftA2 :: (a -> b -> c) -> HandlerFor site a -> HandlerFor site b -> HandlerFor site c # (*>) :: HandlerFor site a -> HandlerFor site b -> HandlerFor site b # (<*) :: HandlerFor site a -> HandlerFor site b -> HandlerFor site a # | |||||||||
| Functor (HandlerFor site) Source # | |||||||||
Defined in Yesod.Core.Types Methods fmap :: (a -> b) -> HandlerFor site a -> HandlerFor site b # (<$) :: a -> HandlerFor site b -> HandlerFor site a # | |||||||||
| Monad (HandlerFor site) Source # | |||||||||
Defined in Yesod.Core.Types Methods (>>=) :: HandlerFor site a -> (a -> HandlerFor site b) -> HandlerFor site b # (>>) :: HandlerFor site a -> HandlerFor site b -> HandlerFor site b # return :: a -> HandlerFor site a # | |||||||||
| MonadThrow (HandlerFor site) Source # | |||||||||
Defined in Yesod.Core.Types Methods throwM :: (HasCallStack, Exception e) => e -> HandlerFor site a # | |||||||||
| MonadLogger (HandlerFor site) Source # | |||||||||
Defined in Yesod.Core.Types Methods monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> HandlerFor site () # | |||||||||
| MonadLoggerIO (HandlerFor site) Source # | |||||||||
Defined in Yesod.Core.Types Methods askLoggerIO :: HandlerFor site (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) # | |||||||||
| PrimMonad (HandlerFor site) Source # | Since: 1.6.7 | ||||||||
Defined in Yesod.Core.Types Associated Types
Methods primitive :: (State# (PrimState (HandlerFor site)) -> (# State# (PrimState (HandlerFor site)), a #)) -> HandlerFor site a # | |||||||||
| MonadResource (HandlerFor site) Source # | |||||||||
Defined in Yesod.Core.Types Methods liftResourceT :: ResourceT IO a -> HandlerFor site a # | |||||||||
| MonadUnliftIO (HandlerFor site) Source # | Since: 1.4.38 | ||||||||
Defined in Yesod.Core.Types Methods withRunInIO :: ((forall a. HandlerFor site a -> IO a) -> IO b) -> HandlerFor site b # | |||||||||
| MonadHandler (HandlerFor site) Source # | |||||||||
Defined in Yesod.Core.Class.Handler Associated Types
Methods liftHandler :: HandlerFor (HandlerSite (HandlerFor site)) a -> HandlerFor site a Source # liftSubHandler :: SubHandlerFor (SubHandlerSite (HandlerFor site)) (HandlerSite (HandlerFor site)) a -> HandlerFor site a Source # | |||||||||
| MonadReader (HandlerData site site) (HandlerFor site) Source # | |||||||||
Defined in Yesod.Core.Types Methods ask :: HandlerFor site (HandlerData site site) # local :: (HandlerData site site -> HandlerData site site) -> HandlerFor site a -> HandlerFor site a # reader :: (HandlerData site site -> a) -> HandlerFor site a # | |||||||||
| type PrimState (HandlerFor site) Source # | |||||||||
Defined in Yesod.Core.Types | |||||||||
| type HandlerSite (HandlerFor site) Source # | |||||||||
Defined in Yesod.Core.Class.Handler | |||||||||
| type SubHandlerSite (HandlerFor site) Source # | |||||||||
Defined in Yesod.Core.Class.Handler | |||||||||
type RequestBodyContents = ([(Text, Text)], [(Text, FileInfo)]) Source #
A tuple containing both the POST parameters and submitted files.
data YesodRequest Source #
The parsed request information. This type augments the standard WAI
Request with additional information.
Constructors
| YesodRequest | |
Fields
| |
type SessionMap = Map Text ByteString Source #
newtype SubHandlerFor sub master a Source #
A handler monad for subsite
Since: 1.6.0
Constructors
| SubHandlerFor | |
Fields
| |
Instances
| MonadIO (SubHandlerFor child master) Source # | |||||||||
Defined in Yesod.Core.Types Methods liftIO :: IO a -> SubHandlerFor child master a # | |||||||||
| Applicative (SubHandlerFor child master) Source # | |||||||||
Defined in Yesod.Core.Types Methods pure :: a -> SubHandlerFor child master a # (<*>) :: SubHandlerFor child master (a -> b) -> SubHandlerFor child master a -> SubHandlerFor child master b # liftA2 :: (a -> b -> c) -> SubHandlerFor child master a -> SubHandlerFor child master b -> SubHandlerFor child master c # (*>) :: SubHandlerFor child master a -> SubHandlerFor child master b -> SubHandlerFor child master b # (<*) :: SubHandlerFor child master a -> SubHandlerFor child master b -> SubHandlerFor child master a # | |||||||||
| Functor (SubHandlerFor sub master) Source # | |||||||||
Defined in Yesod.Core.Types Methods fmap :: (a -> b) -> SubHandlerFor sub master a -> SubHandlerFor sub master b # (<$) :: a -> SubHandlerFor sub master b -> SubHandlerFor sub master a # | |||||||||
| Monad (SubHandlerFor child master) Source # | |||||||||
Defined in Yesod.Core.Types Methods (>>=) :: SubHandlerFor child master a -> (a -> SubHandlerFor child master b) -> SubHandlerFor child master b # (>>) :: SubHandlerFor child master a -> SubHandlerFor child master b -> SubHandlerFor child master b # return :: a -> SubHandlerFor child master a # | |||||||||
| MonadThrow (SubHandlerFor child master) Source # | |||||||||
Defined in Yesod.Core.Types Methods throwM :: (HasCallStack, Exception e) => e -> SubHandlerFor child master a # | |||||||||
| MonadLogger (SubHandlerFor child master) Source # | |||||||||
Defined in Yesod.Core.Types Methods monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> SubHandlerFor child master () # | |||||||||
| MonadLoggerIO (SubHandlerFor child master) Source # | |||||||||
Defined in Yesod.Core.Types Methods askLoggerIO :: SubHandlerFor child master (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) # | |||||||||
| MonadResource (SubHandlerFor child master) Source # | |||||||||
Defined in Yesod.Core.Types Methods liftResourceT :: ResourceT IO a -> SubHandlerFor child master a # | |||||||||
| MonadUnliftIO (SubHandlerFor child master) Source # | Since: 1.4.38 | ||||||||
Defined in Yesod.Core.Types Methods withRunInIO :: ((forall a. SubHandlerFor child master a -> IO a) -> IO b) -> SubHandlerFor child master b # | |||||||||
| MonadHandler (SubHandlerFor sub master) Source # | |||||||||
Defined in Yesod.Core.Class.Handler Associated Types
Methods liftHandler :: HandlerFor (HandlerSite (SubHandlerFor sub master)) a -> SubHandlerFor sub master a Source # liftSubHandler :: SubHandlerFor (SubHandlerSite (SubHandlerFor sub master)) (HandlerSite (SubHandlerFor sub master)) a -> SubHandlerFor sub master a Source # | |||||||||
| MonadReader (HandlerData child master) (SubHandlerFor child master) Source # | |||||||||
Defined in Yesod.Core.Types Methods ask :: SubHandlerFor child master (HandlerData child master) # local :: (HandlerData child master -> HandlerData child master) -> SubHandlerFor child master a -> SubHandlerFor child master a # reader :: (HandlerData child master -> a) -> SubHandlerFor child master a # | |||||||||
| type HandlerSite (SubHandlerFor sub master) Source # | |||||||||
Defined in Yesod.Core.Class.Handler | |||||||||
| type SubHandlerSite (SubHandlerFor sub master) Source # | |||||||||
Defined in Yesod.Core.Class.Handler | |||||||||
newtype WidgetFor site a Source #
A generic widget, allowing specification of both the subsite and master
site datatypes. While this is simply a WriterT, we define a newtype for
better error messages.
Constructors
| WidgetFor | |
Fields
| |
Instances
| (site' ~ site, a ~ ()) => ToWidget site' (WidgetFor site a) Source # | |||||||||
Defined in Yesod.Core.Widget Methods toWidget :: (MonadWidget m, HandlerSite m ~ site') => WidgetFor site a -> m () Source # | |||||||||
| MonadIO (WidgetFor site) Source # | |||||||||
Defined in Yesod.Core.Types | |||||||||
| Applicative (WidgetFor site) Source # | |||||||||
Defined in Yesod.Core.Types Methods pure :: a -> WidgetFor site a # (<*>) :: WidgetFor site (a -> b) -> WidgetFor site a -> WidgetFor site b # liftA2 :: (a -> b -> c) -> WidgetFor site a -> WidgetFor site b -> WidgetFor site c # (*>) :: WidgetFor site a -> WidgetFor site b -> WidgetFor site b # (<*) :: WidgetFor site a -> WidgetFor site b -> WidgetFor site a # | |||||||||
| Functor (WidgetFor site) Source # | |||||||||
| Monad (WidgetFor site) Source # | |||||||||
| MonadThrow (WidgetFor site) Source # | |||||||||
Defined in Yesod.Core.Types Methods throwM :: (HasCallStack, Exception e) => e -> WidgetFor site a # | |||||||||
| MonadLogger (WidgetFor site) Source # | |||||||||
Defined in Yesod.Core.Types | |||||||||
| MonadLoggerIO (WidgetFor site) Source # | |||||||||
Defined in Yesod.Core.Types | |||||||||
| PrimMonad (WidgetFor site) Source # | Since: 1.6.7 | ||||||||
| MonadResource (WidgetFor site) Source # | |||||||||
Defined in Yesod.Core.Types Methods liftResourceT :: ResourceT IO a -> WidgetFor site a # | |||||||||
| MonadUnliftIO (WidgetFor site) Source # | Since: 1.4.38 | ||||||||
Defined in Yesod.Core.Types | |||||||||
| MonadHandler (WidgetFor site) Source # | |||||||||
Defined in Yesod.Core.Class.Handler Associated Types
Methods liftHandler :: HandlerFor (HandlerSite (WidgetFor site)) a -> WidgetFor site a Source # liftSubHandler :: SubHandlerFor (SubHandlerSite (WidgetFor site)) (HandlerSite (WidgetFor site)) a -> WidgetFor site a Source # | |||||||||
| MonadWidget (WidgetFor site) Source # | |||||||||
Defined in Yesod.Core.Class.Handler Methods liftWidget :: WidgetFor (HandlerSite (WidgetFor site)) a -> WidgetFor site a Source # | |||||||||
| MonadReader (WidgetData site) (WidgetFor site) Source # | |||||||||
Defined in Yesod.Core.Types Methods ask :: WidgetFor site (WidgetData site) # local :: (WidgetData site -> WidgetData site) -> WidgetFor site a -> WidgetFor site a # reader :: (WidgetData site -> a) -> WidgetFor site a # | |||||||||
| a ~ () => IsString (WidgetFor site a) Source # | A For example, in a yesod-scaffold site you could use: getHomeR = do defaultLayout "Widget text" | ||||||||
Defined in Yesod.Core.Types Methods fromString :: String -> WidgetFor site a # | |||||||||
| a ~ () => Monoid (WidgetFor site a) Source # | |||||||||
| a ~ () => Semigroup (WidgetFor site a) Source # | |||||||||
| type PrimState (WidgetFor site) Source # | |||||||||
Defined in Yesod.Core.Types | |||||||||
| type HandlerSite (WidgetFor site) Source # | |||||||||
Defined in Yesod.Core.Class.Handler | |||||||||
| type SubHandlerSite (WidgetFor site) Source # | |||||||||
Defined in Yesod.Core.Class.Handler | |||||||||
data PageContent url Source #
Content for a web page. By providing this datatype, we can easily create generic site templates, which would have the type signature:
PageContent url -> HtmlUrl url
Constructors
| PageContent | |
newtype CssBuilder Source #
Newtype wrapper allowing injection of arbitrary content into CSS.
Usage:
toWidget $ CssBuilder "p { color: red }"Since: 1.1.3
Constructors
| CssBuilder | |
Fields | |
Instances
| ToWidget site CssBuilder Source # | |
Defined in Yesod.Core.Widget Methods toWidget :: (MonadWidget m, HandlerSite m ~ site) => CssBuilder -> m () Source # | |
| ToWidgetHead site CssBuilder Source # | |
Defined in Yesod.Core.Widget Methods toWidgetHead :: (MonadWidget m, HandlerSite m ~ site) => CssBuilder -> m () Source # | |
| ToWidgetMedia site CssBuilder Source # | |
Defined in Yesod.Core.Widget Methods toWidgetMedia :: (MonadWidget m, HandlerSite m ~ site) => Text -> CssBuilder -> m () Source # | |
| render ~ RY site => ToWidget site (render -> CssBuilder) Source # | |
Defined in Yesod.Core.Widget Methods toWidget :: (MonadWidget m, HandlerSite m ~ site) => (render -> CssBuilder) -> m () Source # | |
| render ~ RY site => ToWidgetHead site (render -> CssBuilder) Source # | |
Defined in Yesod.Core.Widget Methods toWidgetHead :: (MonadWidget m, HandlerSite m ~ site) => (render -> CssBuilder) -> m () Source # | |
| render ~ RY site => ToWidgetMedia site (render -> CssBuilder) Source # | |
Defined in Yesod.Core.Widget Methods toWidgetMedia :: (MonadWidget m, HandlerSite m ~ site) => Text -> (render -> CssBuilder) -> m () Source # | |
data ClientSessionDateCache Source #
Constructors
| ClientSessionDateCache | |
Fields
| |
Instances
| Show ClientSessionDateCache Source # | |
Defined in Yesod.Core.Types Methods showsPrec :: Int -> ClientSessionDateCache -> ShowS # show :: ClientSessionDateCache -> String # showList :: [ClientSessionDateCache] -> ShowS # | |
| Eq ClientSessionDateCache Source # | |
Defined in Yesod.Core.Types Methods (==) :: ClientSessionDateCache -> ClientSessionDateCache -> Bool # (/=) :: ClientSessionDateCache -> ClientSessionDateCache -> Bool # | |
type SaveSession Source #
Arguments
| = SessionMap | The session contents after running the handler |
| -> IO [Header] |
data SessionCookie Source #
Constructors
| SessionCookie !(Either UTCTime ByteString) !ByteString !SessionMap |
Instances
| Read SessionCookie Source # | |
Defined in Yesod.Core.Types Methods readsPrec :: Int -> ReadS SessionCookie # readList :: ReadS [SessionCookie] # | |
| Show SessionCookie Source # | |
Defined in Yesod.Core.Types Methods showsPrec :: Int -> SessionCookie -> ShowS # show :: SessionCookie -> String # showList :: [SessionCookie] -> ShowS # | |
| Serialize SessionCookie Source # | |
Defined in Yesod.Core.Types | |
data YesodResponse Source #
An augmented WAI Response. This can either be a standard Response,
or a higher-level data structure which Yesod will turn into a Response.
Constructors
| YRWai !Response | |
| YRWaiApp !Application | |
| YRPlain !Status ![Header] !ContentType !Content !SessionMap |
type ResolvedApproot = Text Source #
data RunHandlerEnv child site Source #
Constructors
| RunHandlerEnv | |
Fields
| |
type YesodApp = YesodRequest -> ResourceT IO YesodResponse Source #
An extension of the basic WAI Application datatype to provide extra
features needed by Yesod. Users should never need to use this directly, as
the HandlerFor monad and template haskell code should hide it away.
data HandlerData child site Source #
Constructors
| HandlerData | |
Fields
| |
Instances
| MonadReader (HandlerData site site) (HandlerFor site) Source # | |
Defined in Yesod.Core.Types Methods ask :: HandlerFor site (HandlerData site site) # local :: (HandlerData site site -> HandlerData site site) -> HandlerFor site a -> HandlerFor site a # reader :: (HandlerData site site -> a) -> HandlerFor site a # | |
| MonadReader (HandlerData child master) (SubHandlerFor child master) Source # | |
Defined in Yesod.Core.Types Methods ask :: SubHandlerFor child master (HandlerData child master) # local :: (HandlerData child master -> HandlerData child master) -> SubHandlerFor child master a -> SubHandlerFor child master a # reader :: (HandlerData child master -> a) -> SubHandlerFor child master a # | |
Constructors
| GHState | |
Fields
| |
data YesodRunnerEnv site Source #
Constructors
| YesodRunnerEnv | |
Fields
| |
data YesodSubRunnerEnv sub parent Source #
Constructors
| YesodSubRunnerEnv | |
Fields
| |
type ParentRunner parent = HandlerFor parent TypedContent -> YesodRunnerEnv parent -> Maybe (Route parent) -> Application Source #
data WidgetData site Source #
Constructors
| WidgetData | |
Instances
| MonadReader (WidgetData site) (WidgetFor site) Source # | |
Defined in Yesod.Core.Types Methods ask :: WidgetFor site (WidgetData site) # local :: (WidgetData site -> WidgetData site) -> WidgetFor site a -> WidgetFor site a # reader :: (WidgetData site -> a) -> WidgetFor site a # | |
Constructors
| GWData | |
Fields
| |
data JSONResponse a where Source #
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
Since: 1.6.14
Constructors
| JSONResponse :: forall a. ToJSON a => a -> JSONResponse a |
Instances
| HasContentType (JSONResponse a) Source # | |
Defined in Yesod.Core.Content Methods getContentType :: Monad m => m (JSONResponse a) -> ContentType Source # | |
| ToContent (JSONResponse a) Source # | |
Defined in Yesod.Core.Content Methods toContent :: JSONResponse a -> Content Source # | |
| ToTypedContent (JSONResponse a) Source # | |
Defined in Yesod.Core.Content Methods toTypedContent :: JSONResponse a -> TypedContent Source # | |
newtype UniqueList x Source #
A diff list that does not directly enforce uniqueness. When creating a widget Yesod will use nub to make it unique.
Constructors
| UniqueList ([x] -> [x]) |
Instances
| Monoid (UniqueList x) Source # | |
Defined in Yesod.Core.Types Methods mempty :: UniqueList x # mappend :: UniqueList x -> UniqueList x -> UniqueList x # mconcat :: [UniqueList x] -> UniqueList x # | |
| Semigroup (UniqueList x) Source # | |
Defined in Yesod.Core.Types Methods (<>) :: UniqueList x -> UniqueList x -> UniqueList x # sconcat :: NonEmpty (UniqueList x) -> UniqueList x # stimes :: Integral b => b -> UniqueList x -> UniqueList x # | |
Constructors
| Script | |
Fields
| |
data Stylesheet url Source #
Constructors
| Stylesheet | |
Fields
| |
Instances
| Show url => Show (Stylesheet url) Source # | |
Defined in Yesod.Core.Types Methods showsPrec :: Int -> Stylesheet url -> ShowS # show :: Stylesheet url -> String # showList :: [Stylesheet url] -> ShowS # | |
| Eq url => Eq (Stylesheet url) Source # | |
Defined in Yesod.Core.Types Methods (==) :: Stylesheet url -> Stylesheet url -> Bool # (/=) :: Stylesheet url -> Stylesheet url -> Bool # | |
newtype Description Source #
Constructors
| Description | |
Fields | |
WaiSubsiteRoute :: [Text] %1 -> [(Text, Text)] %1 -> Route WaiSubsite Source #
WaiSubsiteWithAuthRoute :: [Text] %1 -> [(Text, Text)] %1 -> Route WaiSubsiteWithAuth Source #
data ErrorResponse Source #
Responses to indicate some form of an error occurred.
Constructors
| NotFound | The requested resource was not found.
Examples of when this occurs include when an incorrect URL is used, or |
| InternalError !Text | Some sort of unexpected exception.
If your application uses |
| InvalidArgs ![Text] | Indicates some sort of invalid or missing argument, like a missing query parameter or malformed JSON body.
Examples Yesod functions that send this include |
| NotAuthenticated | Indicates the user is not logged in.
This is thrown when |
| PermissionDenied !Text | Indicates the user doesn't have permission to access the requested resource.
This is thrown when |
| BadMethod !Method | Indicates the URL would have been valid if used with a different HTTP method (e.g. a GET was used, but only POST is handled.) HTTP code: 405. |
Instances
| Generic ErrorResponse Source # | |||||
Defined in Yesod.Core.Types.ErrorResponse Associated Types
| |||||
| Show ErrorResponse Source # | |||||
Defined in Yesod.Core.Types.ErrorResponse Methods showsPrec :: Int -> ErrorResponse -> ShowS # show :: ErrorResponse -> String # showList :: [ErrorResponse] -> ShowS # | |||||
| NFData ErrorResponse Source # | |||||
Defined in Yesod.Core.Types.ErrorResponse Methods rnf :: ErrorResponse -> () # | |||||
| Eq ErrorResponse Source # | |||||
Defined in Yesod.Core.Types.ErrorResponse Methods (==) :: ErrorResponse -> ErrorResponse -> Bool # (/=) :: ErrorResponse -> ErrorResponse -> Bool # | |||||
| type Rep ErrorResponse Source # | |||||
Defined in Yesod.Core.Types.ErrorResponse type Rep ErrorResponse = D1 ('MetaData "ErrorResponse" "Yesod.Core.Types.ErrorResponse" "yesod-core-1.6.29.1-5hlKjj91HCoDYYWU0R5CEU" 'False) ((C1 ('MetaCons "NotFound" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "InternalError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text)) :+: C1 ('MetaCons "InvalidArgs" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [Text])))) :+: (C1 ('MetaCons "NotAuthenticated" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "PermissionDenied" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text)) :+: C1 ('MetaCons "BadMethod" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Method))))) | |||||
Constructors
| ContentBuilder !Builder !(Maybe Int) | The content and optional content length. Note that, despite |
| ContentSource !(ConduitT () (Flush Builder) (ResourceT IO) ()) | |
| ContentFile !FilePath !(Maybe FilePart) | |
| ContentDontEvaluate !Content | Used internally to wrap |
Instances
| IsString Content Source # | |
Defined in Yesod.Core.Types Methods fromString :: String -> Content # | |
| ToContent Content Source # | |
| ToContent (ContentType, Content) Source # | |
Defined in Yesod.Core.Content | |
| ToTypedContent (ContentType, Content) Source # | |
Defined in Yesod.Core.Content Methods toTypedContent :: (ContentType, Content) -> TypedContent Source # | |
type ContentType = ByteString Source #
typedContentToSnippet :: TypedContent -> Int64 -> Maybe Text Source #
Represents TypedContent as a String, rendering at most a specified number of bytes of the content, and annotating it with the remaining length. Returns Nothing if the content type indicates the content is binary data.
Since: 1.6.28.0
data TypedContent Source #
Constructors
| TypedContent !ContentType !Content |
Instances
| ToContent TypedContent Source # | |
Defined in Yesod.Core.Content Methods toContent :: TypedContent -> Content Source # | |
| ToTypedContent TypedContent Source # | |
Defined in Yesod.Core.Content Methods | |
data HandlerContents Source #
Constructors
| HCContent !Status !TypedContent | |
| HCError !ErrorResponse | |
| HCSendFile !ContentType !FilePath !(Maybe FilePart) | |
| HCRedirect !Status !Text | |
| HCCreated !Text | |
| HCWai !Response | |
| HCWaiApp !Application |
Instances
| Exception HandlerContents Source # | |
Defined in Yesod.Core.Types.HandlerContents Methods toException :: HandlerContents -> SomeException # | |
| Show HandlerContents Source # | |
Defined in Yesod.Core.Types.HandlerContents Methods showsPrec :: Int -> HandlerContents -> ShowS # show :: HandlerContents -> String # showList :: [HandlerContents] -> ShowS # | |
class Eq (Route a) => RenderRoute a where Source #
Methods
Instances
| RenderRoute LiteApp Source # | |||||
Defined in Yesod.Core.Internal.LiteApp Associated Types
| |||||
| RenderRoute WaiSubsite Source # | |||||
Defined in Yesod.Core.Types Associated Types
Methods renderRoute :: Route WaiSubsite -> ([Text], [(Text, Text)]) Source # | |||||
| RenderRoute WaiSubsiteWithAuth Source # | |||||
Defined in Yesod.Core.Types Associated Types
Methods renderRoute :: Route WaiSubsiteWithAuth -> ([Text], [(Text, Text)]) Source # | |||||
class RenderRoute a => ParseRoute a where Source #
Methods
Instances
| ParseRoute LiteApp Source # | |
Defined in Yesod.Core.Internal.LiteApp | |
| ParseRoute WaiSubsite Source # | |
Defined in Yesod.Core.Types Methods parseRoute :: ([Text], [(Text, Text)]) -> Maybe (Route WaiSubsite) Source # | |
| ParseRoute WaiSubsiteWithAuth Source # | |
Defined in Yesod.Core.Types Methods parseRoute :: ([Text], [(Text, Text)]) -> Maybe (Route WaiSubsiteWithAuth) Source # | |
The type-safe URLs associated with a site argument.
Instances
| RedirectUrl master (Route master) Source # | |
Defined in Yesod.Core.Handler Methods toTextUrl :: (MonadHandler m, HandlerSite m ~ master) => Route master -> m Text Source # | |
| (key ~ Text, val ~ Text) => RedirectUrl master (Route master, Map key val) Source # | |
Defined in Yesod.Core.Handler Methods toTextUrl :: (MonadHandler m, HandlerSite m ~ master) => (Route master, Map key val) -> m Text Source # | |
| (key ~ Text, val ~ Text) => RedirectUrl master (Route master, [(key, val)]) Source # | |
Defined in Yesod.Core.Handler Methods toTextUrl :: (MonadHandler m, HandlerSite m ~ master) => (Route master, [(key, val)]) -> m Text Source # | |
| Read (Route LiteApp) Source # | |
| Read (Route WaiSubsite) Source # | |
Defined in Yesod.Core.Types Methods readsPrec :: Int -> ReadS (Route WaiSubsite) # readList :: ReadS [Route WaiSubsite] # readPrec :: ReadPrec (Route WaiSubsite) # readListPrec :: ReadPrec [Route WaiSubsite] # | |
| Read (Route WaiSubsiteWithAuth) Source # | |
Defined in Yesod.Core.Types | |
| Show (Route LiteApp) Source # | |
| Show (Route WaiSubsite) Source # | |
Defined in Yesod.Core.Types | |
| Show (Route WaiSubsiteWithAuth) Source # | |
Defined in Yesod.Core.Types | |
| Eq (Route LiteApp) Source # | |
| Eq (Route WaiSubsite) Source # | |
Defined in Yesod.Core.Types Methods (==) :: Route WaiSubsite -> Route WaiSubsite -> Bool # (/=) :: Route WaiSubsite -> Route WaiSubsite -> Bool # | |
| Eq (Route WaiSubsiteWithAuth) Source # | |
Defined in Yesod.Core.Types Methods (==) :: Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth -> Bool # (/=) :: Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth -> Bool # | |
| Ord (Route LiteApp) Source # | |
Defined in Yesod.Core.Internal.LiteApp Methods compare :: Route LiteApp -> Route LiteApp -> Ordering # (<) :: Route LiteApp -> Route LiteApp -> Bool # (<=) :: Route LiteApp -> Route LiteApp -> Bool # (>) :: Route LiteApp -> Route LiteApp -> Bool # (>=) :: Route LiteApp -> Route LiteApp -> Bool # | |
| Ord (Route WaiSubsite) Source # | |
Defined in Yesod.Core.Types Methods compare :: Route WaiSubsite -> Route WaiSubsite -> Ordering # (<) :: Route WaiSubsite -> Route WaiSubsite -> Bool # (<=) :: Route WaiSubsite -> Route WaiSubsite -> Bool # (>) :: Route WaiSubsite -> Route WaiSubsite -> Bool # (>=) :: Route WaiSubsite -> Route WaiSubsite -> Bool # max :: Route WaiSubsite -> Route WaiSubsite -> Route WaiSubsite # min :: Route WaiSubsite -> Route WaiSubsite -> Route WaiSubsite # | |
| Ord (Route WaiSubsiteWithAuth) Source # | |
Defined in Yesod.Core.Types Methods compare :: Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth -> Ordering # (<) :: Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth -> Bool # (<=) :: Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth -> Bool # (>) :: Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth -> Bool # (>=) :: Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth -> Bool # max :: Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth # min :: Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth # | |
| data Route LiteApp Source # | |
Defined in Yesod.Core.Internal.LiteApp | |
| data Route WaiSubsite Source # | |
Defined in Yesod.Core.Types | |
| data Route WaiSubsiteWithAuth Source # | |
Defined in Yesod.Core.Types | |
type KeyedTypeMap = HashMap (TypeRep, ByteString) Dynamic Source #