yesod-core-1.4.37.2: Creation of type-safe, RESTful web applications.

Safe HaskellNone
LanguageHaskell98

Yesod.Core.Types

Synopsis

Documentation

type SaveSession Source #

Arguments

 = SessionMap

The session contents after running the handler

-> IO [Header] 

newtype SessionBackend Source #

Constructors

SessionBackend 

Fields

data YesodRequest Source #

The parsed request information. This type augments the standard WAI Request with additional information.

Constructors

YesodRequest 

Fields

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.

type RequestBodyContents = ([(Text, Text)], [(Text, FileInfo)]) Source #

A tuple containing both the POST parameters and submitted files.

data Approot master Source #

How to determine the root of the application for constructing URLs.

Note that future versions of Yesod may add new constructors without bumping the major version number. As a result, you should not pattern match on Approot values.

Constructors

ApprootRelative

No application root.

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

type BottomOfHeadAsync master Source #

Arguments

 = [Text]

urls to load asynchronously

-> Maybe (HtmlUrl (Route master))

widget of js to run on async completion

-> HtmlUrl (Route master)

widget to insert at the bottom of head

type Texts = [Text] Source #

newtype WaiSubsite Source #

Wrap up a normal WAI application as a Yesod subsite. Ignore parent site's middleware and isAuthorized.

Constructors

WaiSubsite 

Instances

newtype WaiSubsiteWithAuth Source #

Like WaiSubsite, but applies parent site's middleware and isAuthorized.

Since: 1.4.34

Instances

ParseRoute WaiSubsiteWithAuth Source # 
RenderRoute WaiSubsiteWithAuth Source # 

Associated Types

data Route WaiSubsiteWithAuth :: * Source #

YesodSubDispatch WaiSubsiteWithAuth (HandlerT master IO) Source # 
Eq (Route WaiSubsiteWithAuth) Source # 
Ord (Route WaiSubsiteWithAuth) Source # 
Read (Route WaiSubsiteWithAuth) Source # 
Show (Route WaiSubsiteWithAuth) Source # 
data Route WaiSubsiteWithAuth Source # 

data RunHandlerEnv site Source #

Constructors

RunHandlerEnv 

Fields

data HandlerData site parentRoute Source #

data YesodSubRunnerEnv sub parent parentMonad Source #

Constructors

YesodSubRunnerEnv 

Fields

type ParentRunner parent m = m TypedContent -> YesodRunnerEnv parent -> Maybe (Route parent) -> Application Source #

newtype HandlerT site m a Source #

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

Constructors

HandlerT 

Fields

Instances

MonadBaseControl b m => MonadBaseControl b (HandlerT site m) Source #

Note: although we provide a MonadBaseControl instance, lifted-base's fork function is incompatible with the underlying ResourceT system. Instead, if you must fork a separate thread, you should use resourceForkIO.

Using fork usually leads to an exception that says "Control.Monad.Trans.Resource.register': The mutable state is being accessed after cleanup. Please contact the maintainers."

Associated Types

type StM (HandlerT site m :: * -> *) a :: * #

Methods

liftBaseWith :: (RunInBase (HandlerT site m) b -> b a) -> HandlerT site m a #

restoreM :: StM (HandlerT site m) a -> HandlerT site m a #

MonadBase b m => MonadBase b (HandlerT site m) Source # 

Methods

liftBase :: b α -> HandlerT site m α #

Monad m => MonadReader site (HandlerT site m) Source # 

Methods

ask :: HandlerT site m site #

local :: (site -> site) -> HandlerT site m a -> HandlerT site m a #

reader :: (site -> a) -> HandlerT site m a #

YesodSubDispatch WaiSubsiteWithAuth (HandlerT master IO) Source # 
MonadTrans (HandlerT site) Source # 

Methods

lift :: Monad m => m a -> HandlerT site m a #

Monad m => Monad (HandlerT site m) Source # 

Methods

(>>=) :: HandlerT site m a -> (a -> HandlerT site m b) -> HandlerT site m b #

(>>) :: HandlerT site m a -> HandlerT site m b -> HandlerT site m b #

return :: a -> HandlerT site m a #

fail :: String -> HandlerT site m a #

Monad m => Functor (HandlerT site m) Source # 

Methods

fmap :: (a -> b) -> HandlerT site m a -> HandlerT site m b #

(<$) :: a -> HandlerT site m b -> HandlerT site m a #

Monad m => Applicative (HandlerT site m) Source # 

Methods

pure :: a -> HandlerT site m a #

(<*>) :: HandlerT site m (a -> b) -> HandlerT site m a -> HandlerT site m b #

(*>) :: HandlerT site m a -> HandlerT site m b -> HandlerT site m b #

(<*) :: HandlerT site m a -> HandlerT site m b -> HandlerT site m a #

MonadIO m => MonadIO (HandlerT site m) Source # 

Methods

liftIO :: IO a -> HandlerT site m a #

MonadActive m => MonadActive (HandlerT site m) Source # 

Methods

monadActive :: HandlerT site m Bool #

MonadThrow m => MonadThrow (HandlerT site m) Source # 

Methods

throwM :: Exception e => e -> HandlerT site m a #

MonadCatch m => MonadCatch (HandlerT site m) Source # 

Methods

catch :: Exception e => HandlerT site m a -> (e -> HandlerT site m a) -> HandlerT site m a #

MonadMask m => MonadMask (HandlerT site m) Source # 

Methods

mask :: ((forall a. HandlerT site m a -> HandlerT site m a) -> HandlerT site m b) -> HandlerT site m b #

uninterruptibleMask :: ((forall a. HandlerT site m a -> HandlerT site m a) -> HandlerT site m b) -> HandlerT site m b #

MonadIO m => MonadLogger (HandlerT site m) Source # 

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> HandlerT site m () #

MonadIO m => MonadLoggerIO (HandlerT site m) Source # 

Methods

askLoggerIO :: HandlerT site m (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) #

(MonadIO m, MonadBase IO m, MonadThrow m) => MonadResource (HandlerT site m) Source # 

Methods

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

MonadResourceBase m => MonadHandler (HandlerT site m) Source # 

Associated Types

type HandlerSite (HandlerT site m :: * -> *) :: * Source #

Methods

liftHandlerT :: HandlerT (HandlerSite (HandlerT site m)) IO a -> HandlerT site m a Source #

type MonadRoute (HandlerT site m) Source # 
type MonadRoute (HandlerT site m) = Route site
type HandlerSite (HandlerT site m) Source # 
type HandlerSite (HandlerT site m) = site
type StM (HandlerT site m) a Source # 
type StM (HandlerT site m) a = StM m a

type family MonadRoute (m :: * -> *) Source #

Instances

type MonadRoute IO Source # 
type MonadRoute IO = ()
type MonadRoute (HandlerT site m) Source # 
type MonadRoute (HandlerT site m) = Route site

data GHState Source #

Constructors

GHState 

type YesodApp = YesodRequest -> ResourceT IO YesodResponse Source #

An extension of the basic WAI Application datatype to provide extra features needed by Yesod. Users should never need to use this directly, as the HandlerT monad and template haskell code should hide it away.

newtype WidgetT site m a Source #

A generic widget, allowing specification of both the subsite and master site datatypes. While this is simply a WriterT, we define a newtype for better error messages.

Constructors

WidgetT 

Fields

Instances

MonadBaseControl b m => MonadBaseControl b (WidgetT site m) Source # 

Associated Types

type StM (WidgetT site m :: * -> *) a :: * #

Methods

liftBaseWith :: (RunInBase (WidgetT site m) b -> b a) -> WidgetT site m a #

restoreM :: StM (WidgetT site m) a -> WidgetT site m a #

MonadBase b m => MonadBase b (WidgetT site m) Source # 

Methods

liftBase :: b α -> WidgetT site m α #

Monad m => MonadReader site (WidgetT site m) Source # 

Methods

ask :: WidgetT site m site #

local :: (site -> site) -> WidgetT site m a -> WidgetT site m a #

reader :: (site -> a) -> WidgetT site m a #

((~) * site' site, (~) (* -> *) IO m, (~) * a ()) => ToWidget site' (WidgetT site m a) Source # 

Methods

toWidget :: (MonadWidget m, (* ~ HandlerSite m) site') => WidgetT site m a -> m () Source #

MonadTrans (WidgetT site) Source # 

Methods

lift :: Monad m => m a -> WidgetT site m a #

Monad m => Monad (WidgetT site m) Source # 

Methods

(>>=) :: WidgetT site m a -> (a -> WidgetT site m b) -> WidgetT site m b #

(>>) :: WidgetT site m a -> WidgetT site m b -> WidgetT site m b #

return :: a -> WidgetT site m a #

fail :: String -> WidgetT site m a #

Monad m => Functor (WidgetT site m) Source # 

Methods

fmap :: (a -> b) -> WidgetT site m a -> WidgetT site m b #

(<$) :: a -> WidgetT site m b -> WidgetT site m a #

Monad m => Applicative (WidgetT site m) Source # 

Methods

pure :: a -> WidgetT site m a #

(<*>) :: WidgetT site m (a -> b) -> WidgetT site m a -> WidgetT site m b #

(*>) :: WidgetT site m a -> WidgetT site m b -> WidgetT site m b #

(<*) :: WidgetT site m a -> WidgetT site m b -> WidgetT site m a #

MonadIO m => MonadIO (WidgetT site m) Source # 

Methods

liftIO :: IO a -> WidgetT site m a #

MonadActive m => MonadActive (WidgetT site m) Source # 

Methods

monadActive :: WidgetT site m Bool #

MonadThrow m => MonadThrow (WidgetT site m) Source # 

Methods

throwM :: Exception e => e -> WidgetT site m a #

MonadCatch m => MonadCatch (WidgetT site m) Source # 

Methods

catch :: Exception e => WidgetT site m a -> (e -> WidgetT site m a) -> WidgetT site m a #

MonadMask m => MonadMask (WidgetT site m) Source # 

Methods

mask :: ((forall a. WidgetT site m a -> WidgetT site m a) -> WidgetT site m b) -> WidgetT site m b #

uninterruptibleMask :: ((forall a. WidgetT site m a -> WidgetT site m a) -> WidgetT site m b) -> WidgetT site m b #

MonadIO m => MonadLogger (WidgetT site m) Source # 

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> WidgetT site m () #

MonadIO m => MonadLoggerIO (WidgetT site m) Source # 

Methods

askLoggerIO :: WidgetT site m (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) #

(MonadIO m, MonadBase IO m, MonadThrow m) => MonadResource (WidgetT site m) Source # 

Methods

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

MonadResourceBase m => MonadWidget (WidgetT site m) Source # 

Methods

liftWidgetT :: WidgetT (HandlerSite (WidgetT site m)) IO a -> WidgetT site m a Source #

MonadResourceBase m => MonadHandler (WidgetT site m) Source # 

Associated Types

type HandlerSite (WidgetT site m :: * -> *) :: * Source #

Methods

liftHandlerT :: HandlerT (HandlerSite (WidgetT site m)) IO a -> WidgetT site m a Source #

(Monad m, (~) * a ()) => IsString (WidgetT site m a) Source #

A String can be trivially promoted to a widget.

For example, in a yesod-scaffold site you could use:

getHomeR = do defaultLayout "Widget text"

Methods

fromString :: String -> WidgetT site m a #

((~) * a (), Monad m) => Semigroup (WidgetT site m a) Source # 

Methods

(<>) :: WidgetT site m a -> WidgetT site m a -> WidgetT site m a #

sconcat :: NonEmpty (WidgetT site m a) -> WidgetT site m a #

stimes :: Integral b => b -> WidgetT site m a -> WidgetT site m a #

((~) * a (), Monad m) => Monoid (WidgetT site m a) Source # 

Methods

mempty :: WidgetT site m a #

mappend :: WidgetT site m a -> WidgetT site m a -> WidgetT site m a #

mconcat :: [WidgetT site m a] -> WidgetT site m a #

type HandlerSite (WidgetT site m) Source # 
type HandlerSite (WidgetT site m) = site
type StM (WidgetT site m) a Source # 
type StM (WidgetT site m) a = StM m (a, GWData (Route site))

type RY master = Route master -> [(Text, Text)] -> Text Source #

newtype CssBuilder Source #

Newtype wrapper allowing injection of arbitrary content into CSS.

Usage:

toWidget $ CssBuilder "p { color: red }"

Since: 1.1.3

Constructors

CssBuilder 

Instances

ToWidgetHead site CssBuilder Source # 

Methods

toWidgetHead :: (MonadWidget m, (* ~ HandlerSite m) site) => CssBuilder -> m () Source #

ToWidgetMedia site CssBuilder Source # 

Methods

toWidgetMedia :: (MonadWidget m, (* ~ HandlerSite m) site) => Text -> CssBuilder -> m () Source #

ToWidget site CssBuilder Source # 

Methods

toWidget :: (MonadWidget m, (* ~ HandlerSite m) site) => CssBuilder -> m () Source #

(~) * render (RY site) => ToWidgetHead site (render -> CssBuilder) Source # 

Methods

toWidgetHead :: (MonadWidget m, (* ~ HandlerSite m) site) => (render -> CssBuilder) -> m () Source #

(~) * render (RY site) => ToWidgetMedia site (render -> CssBuilder) Source # 

Methods

toWidgetMedia :: (MonadWidget m, (* ~ HandlerSite m) site) => Text -> (render -> CssBuilder) -> m () Source #

(~) * render (RY site) => ToWidget site (render -> CssBuilder) Source # 

Methods

toWidget :: (MonadWidget m, (* ~ HandlerSite m) site) => (render -> CssBuilder) -> m () Source #

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 

Fields

type RepHtml = Html Source #

Deprecated: Please use Html instead

newtype DontFullyEvaluate a Source #

Prevents a response body from being fully evaluated before sending the request.

Since 1.1.0

Constructors

DontFullyEvaluate 

Fields

data ErrorResponse Source #

Responses to indicate some form of an error occurred.

data Header Source #

Headers to be added to a Result.

Instances

data Location url Source #

Constructors

Local url 
Remote Text 

Instances

Eq url => Eq (Location url) Source # 

Methods

(==) :: Location url -> Location url -> Bool #

(/=) :: Location url -> Location url -> Bool #

Show url => Show (Location url) Source # 

Methods

showsPrec :: Int -> Location url -> ShowS #

show :: Location url -> String #

showList :: [Location url] -> ShowS #

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]) 

data Script url Source #

Constructors

Script 

Instances

Eq url => Eq (Script url) Source # 

Methods

(==) :: Script url -> Script url -> Bool #

(/=) :: Script url -> Script url -> Bool #

Show url => Show (Script url) Source # 

Methods

showsPrec :: Int -> Script url -> ShowS #

show :: Script url -> String #

showList :: [Script url] -> ShowS #

data Stylesheet url Source #

Constructors

Stylesheet 

Instances

Eq url => Eq (Stylesheet url) Source # 

Methods

(==) :: Stylesheet url -> Stylesheet url -> Bool #

(/=) :: Stylesheet url -> Stylesheet url -> Bool #

Show url => Show (Stylesheet url) Source # 

Methods

showsPrec :: Int -> Stylesheet url -> ShowS #

show :: Stylesheet url -> String #

showList :: [Stylesheet url] -> ShowS #

newtype Title Source #

Constructors

Title 

Fields

newtype Head url Source #

Constructors

Head (HtmlUrl url) 

Instances

Semigroup (Head a) Source # 

Methods

(<>) :: Head a -> Head a -> Head a #

sconcat :: NonEmpty (Head a) -> Head a #

stimes :: Integral b => b -> Head a -> Head a #

Monoid (Head url) Source # 

Methods

mempty :: Head url #

mappend :: Head url -> Head url -> Head url #

mconcat :: [Head url] -> Head url #

newtype Body url Source #

Constructors

Body (HtmlUrl url) 

Instances

Semigroup (Body a) Source # 

Methods

(<>) :: Body a -> Body a -> Body a #

sconcat :: NonEmpty (Body a) -> Body a #

stimes :: Integral b => b -> Body a -> Body a #

Monoid (Body url) Source # 

Methods

mempty :: Body url #

mappend :: Body url -> Body url -> Body url #

mconcat :: [Body url] -> Body url #

type CssBuilderUrl a = (a -> [(Text, Text)] -> Text) -> Builder Source #

data GWData a Source #

Constructors

GWData 

Instances

Semigroup (GWData a) Source # 

Methods

(<>) :: GWData a -> GWData a -> GWData a #

sconcat :: NonEmpty (GWData a) -> GWData a #

stimes :: Integral b => b -> GWData a -> GWData a #

Monoid (GWData a) Source # 

Methods

mempty :: GWData a #

mappend :: GWData a -> GWData a -> GWData a #

mconcat :: [GWData a] -> GWData a #