Data.MBox

mbox-0.3.4: Read and write standard mailbox files.

Copyright | (c) Gershom Bazerman 2009; ported to Text by Alexander Jerneck 2012
License | BSD 3 Clause
Maintainer | gershomb@gmail.com
Stability | experimental
Safe Haskell | Safe-Inferred
Language | Haskell98

Data.MBox

Description

Reads and writes mboxrd files as per http://www.qmail.org/man/man5/mbox.html.

This module uses Lazy Text pervasively, and should be able to operate as a streaming parser. That is to say, given a lazy stream of Text, and a streaming processing function, you should be able to analyze large mbox files in constant space.

Synopsis

- type MBox = [Message]
- data Message = Message {
  - fromLine :: Text
  - headers :: [Header]
  - body :: Text
  }
- type Header = (Text, Text)
- parseMBox :: Text -> MBox
- parseForward :: Message -> Message
- parseDateHeader :: Text -> Maybe UTCTime
- showMessage :: Message -> Text
- showMBox :: MBox -> Text
- getHeader :: (Header -> Bool) -> Message -> [Text]
- isID :: Header -> Bool
- isDate :: Header -> Bool

# Documentation

type MBox = [Message] #

data Message #

Constructors

Message |
Fields fromLine :: Text headers :: [Header] body :: Text

#### Instances

Instances details

Read Message # |
Instance details Defined in Data.MBox Methods readsPrec :: Int -> ReadS Message # readList :: ReadS [Message] # readPrec :: ReadPrec Message # readListPrec :: ReadPrec [Message] #
Show Message # |
Instance details Defined in Data.MBox Methods showsPrec :: Int -> Message -> ShowS # show :: Message -> String # showList :: [Message] -> ShowS #

type Header = (Text, Text) #

parseMBox :: Text -> MBox #

Parses Text as an mbox file.

parseForward :: Message -> Message #

Attempts to retrieve the contents of a forwarded message from an enclosing message.

parseDateHeader :: Text -> Maybe UTCTime #

Reads a date header as a UTCTime

showMessage :: Message -> Text #

Renders an individual message into Text.

showMBox :: MBox -> Text #

Renders an MBox into Text

getHeader :: (Header -> Bool) -> Message -> [Text] #

Return the values of headers for which predicate is True

isID :: Header -> Bool #

Return True if header is a Message-ID header.

isDate :: Header -> Bool #

Return True if header is a Date header.