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

Safe HaskellNone





data Content Source


ContentBuilder !Builder !(Maybe Int)

The content and optional content length.

ContentSource !(Source (ResourceT IO) (Flush Builder)) 
ContentFile !FilePath !(Maybe FilePart) 
ContentDontEvaluate !Content 

emptyContent :: Content Source

Zero-length enumerator.

class ToContent a where Source

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.


toContent :: a -> Content Source


ToContent String 
ToContent () 
ToContent ByteString 
ToContent ByteString 
ToContent Builder 
ToContent Text 
ToContent Text 
ToContent Html 
ToContent Value 
ToContent Javascript 
ToContent RepXml 
ToContent RepPlain 
ToContent RepJson 
ToContent TypedContent 
ToContent Content 
ToContent Css 
ToContent a => ToContent (DontFullyEvaluate a) 
ToContent (ContentType, Content) 
ToFlushBuilder builder => ToContent (Source (ResourceT IO) builder) 
ToFlushBuilder builder => ToContent (ResumableSource (ResourceT IO) builder) 
ToFlushBuilder builder => ToContent (Pipe () () builder () (ResourceT IO) ()) 

class ToFlushBuilder a where Source

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


toFlushBuilder :: a -> Flush Builder Source

Mime types

Data type


simpleContentType :: ContentType -> ContentType Source

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 Source

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

Since 1.1.0




unDontFullyEvaluate :: a


Specific content types

type RepHtml = Html Source

Deprecated: Please use Html instead

Smart constructors