Data.MBox.String

mbox-0.3.4: Read and write standard mailbox files.

Copyright | (c) Gershom Bazerman 2009
License | BSD 3 Clause
Maintainer | gershomb@gmail.com
Stability | experimental
Safe Haskell | Safe-Inferred
Language | Haskell98

Data.MBox.String

Description

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

This parser is written to be a streaming parser. Given a lazy source of data and a streaming consumer, you should be able to analyze arbitrary mbox files in constant space.

Synopsis

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

# Documentation

type MBox = [Message] #

data Message #

Constructors

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

#### Instances

Instances details

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

type Header = (String, String) #

parseMBox :: String -> MBox #

Reads a string as an mbox file.

parseForward :: Message -> Message #

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

parseDateHeader :: String -> Maybe UTCTime #

Reads a date header as a UTCTime

showMessage :: Message -> String #

Renders an individual message into a String.

showMBox :: MBox -> String #

Renders an MBox into a String

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

isID :: Header -> Bool #

Header accessors

isDate :: Header -> Bool #