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

Safe HaskellNone

Yesod

Contents

Description

This module simply re-exports from other modules for your convenience.

Synopsis

Re-exports from yesod-core

module Yesod.Core

module Yesod.Form

module Yesod.Json

Running your application

warp :: (Yesod a, YesodDispatch a a) => Int -> a -> IO ()Source

A convenience method to run an application using the Warp webserver on the specified port. Automatically calls toWaiApp.

warpDebug :: (Yesod a, YesodDispatch a a) => Int -> a -> IO ()Source

Same as warp, but also sends a message to stdout for each request, and an "application launched" message as well. Can be useful for development.

warpEnv :: (Yesod a, YesodDispatch a a) => a -> IO ()Source

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.

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.

develServerSource

Arguments

:: Int

port number

-> String

module name holding the code

-> String

name of function providing a with-application

-> IO () 

Run a development server, where your code changes are automatically reloaded.

Commonly referenced functions/datatypes

liftIO :: MonadIO m => forall a. IO a -> m a

Lift a computation from the IO monad.

class MonadBase b m => MonadBaseControl b m | m -> b

Instances

MonadBaseControl [] [] 
MonadBaseControl IO IO 
MonadBaseControl Maybe Maybe 
MonadBaseControl STM STM 
MonadBaseControl Identity Identity 
MonadBaseControl b m => MonadBaseControl b (ResourceT m) 
MonadBaseControl b m => MonadBaseControl b (ExceptionT m) 
MonadBaseControl backend m => MonadBaseControl backend (SqlPersist m) 
MonadBaseControl b m => MonadBaseControl b (MaybeT m) 
MonadBaseControl b m => MonadBaseControl b (ListT m) 
MonadBaseControl b m => MonadBaseControl b (IdentityT m) 
MonadBaseControl IO (GHandler sub master)

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."

(Monoid w, MonadBaseControl b m) => MonadBaseControl b (WriterT w m) 
(Monoid w, MonadBaseControl b m) => MonadBaseControl b (WriterT w m) 
MonadBaseControl b m => MonadBaseControl b (StateT s m) 
MonadBaseControl b m => MonadBaseControl b (StateT s m) 
MonadBaseControl b m => MonadBaseControl b (ReaderT r m) 
(Error e, MonadBaseControl b m) => MonadBaseControl b (ErrorT e m) 
(Monoid w, MonadBaseControl b m) => MonadBaseControl b (RWST r w s m) 
(Monoid w, MonadBaseControl b m) => MonadBaseControl b (RWST r w s m) 
MonadBaseControl ((->) r) ((->) r) 
MonadBaseControl (Either e) (Either e) 
MonadBaseControl (ST s) (ST s) 
MonadBaseControl (ST s) (ST s) 

Utilities

Hamlet library

Hamlet

type HtmlUrl url = Render url -> Html

A function generating an Html given a URL-rendering function.

type Html = Markup

toHtml :: ToMarkup a => a -> Html

Julius

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

Return type of template-reading functions.

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

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.

toJSON :: ToJSON a => a -> Value

Cassius/Lucius

lucius :: QuasiQuoter

>>> renderCss ([lucius|foo{bar:baz}|] undefined)
"foo{bar:baz}"

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

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