email-header-0.4.0: Parsing and rendering of email and MIME headers

Safe HaskellNone
LanguageHaskell98

Network.Email.Header.Doc

Contents

Description

Header formatting and pretty-printing.

Synopsis

Rendering options

data RenderOptions Source #

Rendering options.

Constructors

RenderOptions 

Fields

data Encoding Source #

The encoding used for binary characters in an encoded word.

Constructors

QP

Quoted-printable encoding. Spaces are represented with underscores, and undisplayable characters are represented as hex pairs.

Base64

Base 64 encoding of all characters.

defaultRenderOptions :: RenderOptions Source #

Default rendering options, which uses a line width of 80, and indent of 2, and utf-8 quated-printable encoding.

Rendering

data Doc Source #

A formatted email header.

Instances

IsString Doc Source # 

Methods

fromString :: String -> Doc #

Monoid Doc Source # 

Methods

mempty :: Doc #

mappend :: Doc -> Doc -> Doc #

mconcat :: [Doc] -> Doc #

render :: RenderOptions -> Int -> Doc -> Builder Source #

Render a document with the given options and initial position.

Construction

prim :: (RenderOptions -> Bool -> Layout Builder) -> Doc Source #

Construct a primitive document from a layout function. The function takes two parameters: the rendering options, and a Bool which indicates whether the containing group is laid out horizontally instead of vertically.

group :: Doc -> Doc Source #

Specify an alternative layout with all line breaks flattened.

builder :: Int -> Builder -> Doc Source #

Construct a Doc from a Builder and a length.

string :: String -> Doc Source #

Construct a Doc from a String.

byteString :: ByteString -> Doc Source #

Construct a Doc from a ByteString.

text :: Text -> Doc Source #

Construct a Builder from a Text.

Spacing

space :: Layout Builder Source #

A space layout.

newline :: RenderOptions -> Layout Builder Source #

A newline layout. This will emit a CRLF pair, break to a new line, and indent.

line :: Doc Source #

A line break. If undone, behaves like a space.

linebreak :: Doc Source #

A line break. If undone, behaves like mempty.

softline :: Doc Source #

A space if the remaining layout fits, and a line break otherwise.

softbreak :: Doc Source #

mempty if the remaining layout fits, and a line break otherwise.

(</>) :: Doc -> Doc -> Doc infixr 6 Source #

Concatenate with a softline in between.

Combinators

sep :: [Doc] -> Doc Source #

Separate a list with spaces if it fits. Otherwise, separate with lines.

punctuate :: Monoid a => a -> [a] -> [a] Source #

punctuate p xs appends p to every element of xs but the last.