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

Safe HaskellNone
LanguageHaskell98

Yesod.Core.Content

Contents

Synopsis

Content

emptyContent :: Content #

Zero-length enumerator.

class ToContent a where #

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.

Minimal complete definition

toContent

Methods

toContent :: a -> Content #

Instances

ToContent () # 

Methods

toContent :: () -> Content #

ToContent ByteString # 
ToContent ByteString # 
ToContent String # 

Methods

toContent :: String -> Content #

ToContent Text # 

Methods

toContent :: Text -> Content #

ToContent Builder # 

Methods

toContent :: Builder -> Content #

ToContent Encoding # 
ToContent Value # 

Methods

toContent :: Value -> Content #

ToContent Text # 

Methods

toContent :: Text -> Content #

ToContent Html # 

Methods

toContent :: Html -> Content #

ToContent Css # 

Methods

toContent :: Css -> Content #

ToContent Javascript # 
ToContent RepXml # 

Methods

toContent :: RepXml -> Content #

ToContent RepPlain # 
ToContent RepJson # 

Methods

toContent :: RepJson -> Content #

ToContent TypedContent # 
ToContent Content # 

Methods

toContent :: Content -> Content #

ToContent a => ToContent (DontFullyEvaluate a) # 
ToContent (ContentType, Content) # 
ToFlushBuilder builder => ToContent (Source (ResourceT IO) builder) # 

Methods

toContent :: Source (ResourceT IO) builder -> Content #

ToFlushBuilder builder => ToContent (ResumableSource (ResourceT IO) builder) # 
ToFlushBuilder builder => ToContent (Pipe () () builder () (ResourceT IO) ()) # 

Methods

toContent :: Pipe () () builder () (ResourceT IO) () -> Content #

Mime types

Data type

Utilities

simpleContentType :: ContentType -> 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".

Evaluation strategy

newtype DontFullyEvaluate a #

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

Since 1.1.0

Constructors

DontFullyEvaluate 

Fields

Representations

Specific content types

type RepHtml = Html #

Deprecated: Please use Html instead

Smart constructors

repJson :: ToContent a => a -> RepJson #

repXml :: ToContent a => a -> RepXml #