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

Safe HaskellNone
LanguageHaskell98

Yesod.Core.Content

Contents

Synopsis

Content

data Content Source #

Constructors

ContentBuilder !Builder !(Maybe Int)

The content and optional content length.

ContentSource !(ConduitT () (Flush Builder) (ResourceT IO) ()) 
ContentFile !FilePath !(Maybe FilePart) 
ContentDontEvaluate !Content 
Instances
IsString Content Source # 
Instance details

Defined in Yesod.Core.Types

Methods

fromString :: String -> Content #

ToContent Content Source # 
Instance details

Defined in Yesod.Core.Content

ToTypedContent (ContentType, Content) Source # 
Instance details

Defined in Yesod.Core.Content

ToContent (ContentType, Content) Source # 
Instance details

Defined in Yesod.Core.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.

Methods

toContent :: a -> Content Source #

Instances
ToContent () Source # 
Instance details

Defined in Yesod.Core.Content

Methods

toContent :: () -> Content Source #

ToContent ByteString Source # 
Instance details

Defined in Yesod.Core.Content

ToContent ByteString Source # 
Instance details

Defined in Yesod.Core.Content

ToContent Builder Source # 
Instance details

Defined in Yesod.Core.Content

ToContent Text Source # 
Instance details

Defined in Yesod.Core.Content

ToContent Encoding Source # 
Instance details

Defined in Yesod.Core.Content

ToContent Value Source # 
Instance details

Defined in Yesod.Core.Content

ToContent String Source # 
Instance details

Defined in Yesod.Core.Content

ToContent Text Source # 
Instance details

Defined in Yesod.Core.Content

ToContent Html Source # 
Instance details

Defined in Yesod.Core.Content

ToContent Css Source # 
Instance details

Defined in Yesod.Core.Content

ToContent Javascript Source # 
Instance details

Defined in Yesod.Core.Content

ToContent RepXml Source # 
Instance details

Defined in Yesod.Core.Content

ToContent RepPlain Source # 
Instance details

Defined in Yesod.Core.Content

ToContent RepJson Source # 
Instance details

Defined in Yesod.Core.Content

ToContent TypedContent Source # 
Instance details

Defined in Yesod.Core.Content

ToContent Content Source # 
Instance details

Defined in Yesod.Core.Content

ToContent a => ToContent (DontFullyEvaluate a) Source # 
Instance details

Defined in Yesod.Core.Content

ToContent (JSONResponse a) Source # 
Instance details

Defined in Yesod.Core.Content

ToContent (ContentType, Content) Source # 
Instance details

Defined in Yesod.Core.Content

ToFlushBuilder builder => ToContent (ConduitT () builder (ResourceT IO) ()) Source # 
Instance details

Defined in Yesod.Core.Content

Methods

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

ToFlushBuilder builder => ToContent (SealedConduitT () builder (ResourceT IO) ()) Source # 
Instance details

Defined in Yesod.Core.Content

Methods

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

ToFlushBuilder builder => ToContent (Pipe () () builder () (ResourceT IO) ()) Source # 
Instance details

Defined in Yesod.Core.Content

Methods

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

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

Instances
ToFlushBuilder ByteString Source # 
Instance details

Defined in Yesod.Core.Content

ToFlushBuilder ByteString Source # 
Instance details

Defined in Yesod.Core.Content

ToFlushBuilder Builder Source # 
Instance details

Defined in Yesod.Core.Content

ToFlushBuilder Text Source # 
Instance details

Defined in Yesod.Core.Content

ToFlushBuilder String Source # 
Instance details

Defined in Yesod.Core.Content

ToFlushBuilder Text Source # 
Instance details

Defined in Yesod.Core.Content

ToFlushBuilder Html Source # 
Instance details

Defined in Yesod.Core.Content

ToFlushBuilder (Flush ByteString) Source # 
Instance details

Defined in Yesod.Core.Content

ToFlushBuilder (Flush ByteString) Source # 
Instance details

Defined in Yesod.Core.Content

ToFlushBuilder (Flush Builder) Source # 
Instance details

Defined in Yesod.Core.Content

ToFlushBuilder (Flush Text) Source # 
Instance details

Defined in Yesod.Core.Content

ToFlushBuilder (Flush String) Source # 
Instance details

Defined in Yesod.Core.Content

ToFlushBuilder (Flush Text) Source # 
Instance details

Defined in Yesod.Core.Content

ToFlushBuilder (Flush Html) Source # 
Instance details

Defined in Yesod.Core.Content

Mime types

Data type

Utilities

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

contentTypeTypes :: ContentType -> (ByteString, ByteString) Source #

Give just the media types as a pair.

For example, "text/html; charset=utf-8" returns ("text", "html")

Evaluation strategy

newtype DontFullyEvaluate a Source #

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

Since 1.1.0

Constructors

DontFullyEvaluate 

Fields

Representations

class ToContent a => ToTypedContent a where Source #

Any type which can be converted to TypedContent.

Since 1.2.0

Instances
ToTypedContent () Source # 
Instance details

Defined in Yesod.Core.Content

ToTypedContent Text Source # 
Instance details

Defined in Yesod.Core.Content

ToTypedContent Encoding Source # 
Instance details

Defined in Yesod.Core.Content

ToTypedContent Value Source # 
Instance details

Defined in Yesod.Core.Content

ToTypedContent Text Source # 
Instance details

Defined in Yesod.Core.Content

ToTypedContent Html Source # 
Instance details

Defined in Yesod.Core.Content

ToTypedContent Css Source # 
Instance details

Defined in Yesod.Core.Content

ToTypedContent Javascript Source # 
Instance details

Defined in Yesod.Core.Content

ToTypedContent RepXml Source # 
Instance details

Defined in Yesod.Core.Content

ToTypedContent RepPlain Source # 
Instance details

Defined in Yesod.Core.Content

ToTypedContent RepJson Source # 
Instance details

Defined in Yesod.Core.Content

ToTypedContent TypedContent Source # 
Instance details

Defined in Yesod.Core.Content

ToTypedContent [Char] Source # 
Instance details

Defined in Yesod.Core.Content

ToTypedContent a => ToTypedContent (DontFullyEvaluate a) Source # 
Instance details

Defined in Yesod.Core.Content

ToTypedContent (JSONResponse a) Source # 
Instance details

Defined in Yesod.Core.Content

ToTypedContent (ContentType, Content) Source # 
Instance details

Defined in Yesod.Core.Content

class ToTypedContent a => HasContentType a where Source #

Methods

getContentType :: Monad m => m a -> ContentType Source #

Instances
HasContentType Text Source # 
Instance details

Defined in Yesod.Core.Content

HasContentType Encoding Source # 
Instance details

Defined in Yesod.Core.Content

HasContentType Value Source # 
Instance details

Defined in Yesod.Core.Content

HasContentType Text Source # 
Instance details

Defined in Yesod.Core.Content

HasContentType Html Source # 
Instance details

Defined in Yesod.Core.Content

HasContentType Css Source # 
Instance details

Defined in Yesod.Core.Content

HasContentType Javascript Source # 
Instance details

Defined in Yesod.Core.Content

HasContentType RepXml Source # 
Instance details

Defined in Yesod.Core.Content

HasContentType RepPlain Source # 
Instance details

Defined in Yesod.Core.Content

HasContentType RepJson Source # 
Instance details

Defined in Yesod.Core.Content

HasContentType a => HasContentType (DontFullyEvaluate a) Source # 
Instance details

Defined in Yesod.Core.Content

HasContentType (JSONResponse a) Source # 
Instance details

Defined in Yesod.Core.Content

Specific content types

type RepHtml = Html Source #

Deprecated: Please use Html instead

newtype RepJson Source #

Constructors

RepJson Content 
Instances
ToTypedContent RepJson Source # 
Instance details

Defined in Yesod.Core.Content

HasContentType RepJson Source # 
Instance details

Defined in Yesod.Core.Content

ToContent RepJson Source # 
Instance details

Defined in Yesod.Core.Content

newtype RepPlain Source #

Constructors

RepPlain Content 
Instances
ToTypedContent RepPlain Source # 
Instance details

Defined in Yesod.Core.Content

HasContentType RepPlain Source # 
Instance details

Defined in Yesod.Core.Content

ToContent RepPlain Source # 
Instance details

Defined in Yesod.Core.Content

newtype RepXml Source #

Constructors

RepXml Content 
Instances
ToTypedContent RepXml Source # 
Instance details

Defined in Yesod.Core.Content

HasContentType RepXml Source # 
Instance details

Defined in Yesod.Core.Content

ToContent RepXml Source # 
Instance details

Defined in Yesod.Core.Content

Smart constructors