Codec.MIME.Type

mime-0.4.0.2: Working with MIME types.

Copyright | (c) 2006-2009 Galois Inc.
License | BSD3
Maintainer | Sigbjorn Finne <sigbjorn.finne@gmail.com>
Stability | provisional
Portability | portable
Safe Haskell | Safe-Inferred
Language | Haskell98

Codec.MIME.Type

Description

Representing MIME types and values.

Synopsis

- data MIMEParam = MIMEParam {
  - paramName :: Text
  - paramValue :: Text
  }
- data Type = Type {
  - mimeType :: MIMEType
  - mimeParams :: [MIMEParam]
  }
- nullType :: Type
- showType :: Type -> Text
- showMIMEParams :: [MIMEParam] -> Text
- data MIMEType
  - = Application SubType
  - | Audio SubType
  - | Image SubType
  - | Message SubType
  - | Model SubType
  - | Multipart Multipart
  - | Text TextType
  - | Video SubType
  - | Other {
    - otherType :: Text
    - otherSubType :: SubType
    }
- showMIMEType :: MIMEType -> Text
- data MIMEPair = MIMEPair Text SubType
- showMIMEPair :: MIMEPair -> Text
- type SubType = Text
- type TextType = SubType
- subTypeString :: Type -> Text
- majTypeString :: Type -> Text
- data Multipart
  - = Alternative
  - | Byteranges
  - | Digest
  - | Encrypted
  - | FormData
  - | Mixed
  - | Parallel
  - | Related
  - | Signed
  - | Extension Text
  - | OtherMulti Text
- isXmlBased :: Type -> Bool
- isXmlType :: Type -> Bool
- showMultipart :: Multipart -> Text
- type Content = Text
- data MIMEValue = MIMEValue {
  - mime_val_type :: Type
  - mime_val_disp :: Maybe Disposition
  - mime_val_content :: MIMEContent
  - mime_val_headers :: [MIMEParam]
  - mime_val_inc_type :: Bool
  }
- nullMIMEValue :: MIMEValue
- data MIMEContent
  - = Single Content
  - | Multi [MIMEValue]
- data Disposition = Disposition {
  - dispType :: DispType
  - dispParams :: [DispParam]
  }
- data DispType
  - = DispInline
  - | DispAttachment
  - | DispFormData
  - | DispOther Text
- data DispParam
  - = Name Text
  - | Filename Text
  - | CreationDate Text
  - | ModDate Text
  - | ReadDate Text
  - | Size Text
  - | OtherParam Text Text

# Documentation

data MIMEParam #

Constructors

MIMEParam |
Fields paramName :: Text paramValue :: Text

#### Instances

Instances details

Show MIMEParam # |
Instance details Defined in Codec.MIME.Type Methods showsPrec :: Int -> MIMEParam -> ShowS # show :: MIMEParam -> String # showList :: [MIMEParam] -> ShowS #
Eq MIMEParam # |
Instance details Defined in Codec.MIME.Type Methods (==) :: MIMEParam -> MIMEParam -> Bool # (/=) :: MIMEParam -> MIMEParam -> Bool #
Ord MIMEParam # |
Instance details Defined in Codec.MIME.Type Methods compare :: MIMEParam -> MIMEParam -> Ordering # (<) :: MIMEParam -> MIMEParam -> Bool # (<=) :: MIMEParam -> MIMEParam -> Bool # (>) :: MIMEParam -> MIMEParam -> Bool # (>=) :: MIMEParam -> MIMEParam -> Bool # max :: MIMEParam -> MIMEParam -> MIMEParam # min :: MIMEParam -> MIMEParam -> MIMEParam #

data Type #

Constructors

Type |
Fields mimeType :: MIMEType mimeParams :: [MIMEParam]

#### Instances

Instances details

Show Type # |
Instance details Defined in Codec.MIME.Type Methods showsPrec :: Int -> Type -> ShowS # show :: Type -> String # showList :: [Type] -> ShowS #
Eq Type # |
Instance details Defined in Codec.MIME.Type Methods (==) :: Type -> Type -> Bool # (/=) :: Type -> Type -> Bool #
Ord Type # |
Instance details Defined in Codec.MIME.Type Methods compare :: Type -> Type -> Ordering # (<) :: Type -> Type -> Bool # (<=) :: Type -> Type -> Bool # (>) :: Type -> Type -> Bool # (>=) :: Type -> Type -> Bool # max :: Type -> Type -> Type # min :: Type -> Type -> Type #

nullType :: Type #

The `null` MIME record type value; currently a `text/plain`.

showType :: Type -> Text #

showMIMEParams :: [MIMEParam] -> Text #

data MIMEType #

Constructors

Application SubType |
Audio SubType |
Image SubType |
Message SubType |
Model SubType |
Multipart Multipart |
Text TextType |
Video SubType |
Other |
Fields otherType :: Text otherSubType :: SubType

#### Instances

Instances details

Show MIMEType # |
Instance details Defined in Codec.MIME.Type Methods showsPrec :: Int -> MIMEType -> ShowS # show :: MIMEType -> String # showList :: [MIMEType] -> ShowS #
Eq MIMEType # |
Instance details Defined in Codec.MIME.Type Methods (==) :: MIMEType -> MIMEType -> Bool # (/=) :: MIMEType -> MIMEType -> Bool #
Ord MIMEType # |
Instance details Defined in Codec.MIME.Type Methods compare :: MIMEType -> MIMEType -> Ordering # (<) :: MIMEType -> MIMEType -> Bool # (<=) :: MIMEType -> MIMEType -> Bool # (>) :: MIMEType -> MIMEType -> Bool # (>=) :: MIMEType -> MIMEType -> Bool # max :: MIMEType -> MIMEType -> MIMEType # min :: MIMEType -> MIMEType -> MIMEType #

showMIMEType :: MIMEType -> Text #

data MIMEPair #

a (type, subtype) MIME pair.

Constructors

MIMEPair Text SubType |

#### Instances

Instances details

Eq MIMEPair # |
Instance details Defined in Codec.MIME.Type Methods (==) :: MIMEPair -> MIMEPair -> Bool # (/=) :: MIMEPair -> MIMEPair -> Bool #

showMIMEPair :: MIMEPair -> Text #

type SubType = Text #

default subtype representation.

type TextType = SubType #

subtype for text content; currently just a string.

subTypeString :: Type -> Text #

majTypeString :: Type -> Text #

data Multipart #

Constructors

Alternative |
Byteranges |
Digest |
Encrypted |
FormData |
Mixed |
Parallel |
Related |
Signed |
Extension Text | e.g., 'x-foo' (i.e., includes the 'x-' bit)
OtherMulti Text |

#### Instances

Instances details

Show Multipart # |
Instance details Defined in Codec.MIME.Type Methods showsPrec :: Int -> Multipart -> ShowS # show :: Multipart -> String # showList :: [Multipart] -> ShowS #
Eq Multipart # |
Instance details Defined in Codec.MIME.Type Methods (==) :: Multipart -> Multipart -> Bool # (/=) :: Multipart -> Multipart -> Bool #
Ord Multipart # |
Instance details Defined in Codec.MIME.Type Methods compare :: Multipart -> Multipart -> Ordering # (<) :: Multipart -> Multipart -> Bool # (<=) :: Multipart -> Multipart -> Bool # (>) :: Multipart -> Multipart -> Bool # (>=) :: Multipart -> Multipart -> Bool # max :: Multipart -> Multipart -> Multipart # min :: Multipart -> Multipart -> Multipart #

isXmlBased :: Type -> Bool #

isXmlType :: Type -> Bool #

showMultipart :: Multipart -> Text #

type Content = Text #

data MIMEValue #

Constructors

MIMEValue |
Fields mime_val_type :: Type mime_val_disp :: Maybe Disposition mime_val_content :: MIMEContent mime_val_headers :: [MIMEParam] mime_val_inc_type :: Bool

#### Instances

Instances details

Show MIMEValue # |
Instance details Defined in Codec.MIME.Type Methods showsPrec :: Int -> MIMEValue -> ShowS # show :: MIMEValue -> String # showList :: [MIMEValue] -> ShowS #
Eq MIMEValue # |
Instance details Defined in Codec.MIME.Type Methods (==) :: MIMEValue -> MIMEValue -> Bool # (/=) :: MIMEValue -> MIMEValue -> Bool #

nullMIMEValue :: MIMEValue #

data MIMEContent #

Constructors

Single Content |
Multi [MIMEValue] |

#### Instances

Instances details

Show MIMEContent # |
Instance details Defined in Codec.MIME.Type Methods showsPrec :: Int -> MIMEContent -> ShowS # show :: MIMEContent -> String # showList :: [MIMEContent] -> ShowS #
Eq MIMEContent # |
Instance details Defined in Codec.MIME.Type Methods (==) :: MIMEContent -> MIMEContent -> Bool # (/=) :: MIMEContent -> MIMEContent -> Bool #

data Disposition #

Constructors

Disposition |
Fields dispType :: DispType dispParams :: [DispParam]

#### Instances

Instances details

Show Disposition # |
Instance details Defined in Codec.MIME.Type Methods showsPrec :: Int -> Disposition -> ShowS # show :: Disposition -> String # showList :: [Disposition] -> ShowS #
Eq Disposition # |
Instance details Defined in Codec.MIME.Type Methods (==) :: Disposition -> Disposition -> Bool # (/=) :: Disposition -> Disposition -> Bool #

data DispType #

Constructors

DispInline |
DispAttachment |
DispFormData |
DispOther Text |

#### Instances

Instances details

Show DispType # |
Instance details Defined in Codec.MIME.Type Methods showsPrec :: Int -> DispType -> ShowS # show :: DispType -> String # showList :: [DispType] -> ShowS #
Eq DispType # |
Instance details Defined in Codec.MIME.Type Methods (==) :: DispType -> DispType -> Bool # (/=) :: DispType -> DispType -> Bool #

data DispParam #

Constructors

Name Text |
Filename Text |
CreationDate Text |
ModDate Text |
ReadDate Text |
Size Text |
OtherParam Text Text |

#### Instances

Instances details

Show DispParam # |
Instance details Defined in Codec.MIME.Type Methods showsPrec :: Int -> DispParam -> ShowS # show :: DispParam -> String # showList :: [DispParam] -> ShowS #
Eq DispParam # |
Instance details Defined in Codec.MIME.Type Methods (==) :: DispParam -> DispParam -> Bool # (/=) :: DispParam -> DispParam -> Bool #