-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | Read and write standard mailbox files.
--   
--   Read and write standard mailbox (mboxrd) files.
@package mbox
@version 0.3.4

-- | 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.
module Data.MBox.String
type MBox = [Message]
data Message
Message :: String -> [Header] -> String -> Message
[fromLine] :: Message -> String
[headers] :: Message -> [Header]
[body] :: Message -> String
type Header = (String, String)

-- | Reads a string as an mbox file.
parseMBox :: String -> MBox

-- | Attempts to retrieve the contents of a forwarded message from an
--   enclosing message.
parseForward :: Message -> Message

-- | Reads a date header as a UTCTime
parseDateHeader :: String -> Maybe UTCTime

-- | Renders an individual message into a String.
showMessage :: Message -> String

-- | Renders an MBox into a String
showMBox :: MBox -> String
getHeader :: (Header -> Bool) -> Message -> [String]

-- | Header accessors
isID :: Header -> Bool
isDate :: Header -> Bool
instance GHC.Show.Show Data.MBox.String.Message
instance GHC.Read.Read Data.MBox.String.Message

-- | 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.
module Data.MBox
type MBox = [Message]
data Message
Message :: Text -> [Header] -> Text -> Message
[fromLine] :: Message -> Text
[headers] :: Message -> [Header]
[body] :: Message -> Text
type Header = (Text, Text)

-- | Parses Text as an mbox file.
parseMBox :: Text -> MBox

-- | Attempts to retrieve the contents of a forwarded message from an
--   enclosing message.
parseForward :: Message -> Message

-- | Reads a date header as a UTCTime
parseDateHeader :: Text -> Maybe UTCTime

-- | Renders an individual message into Text.
showMessage :: Message -> Text

-- | Renders an MBox into Text
showMBox :: MBox -> Text

-- | Return the values of headers for which predicate is True
getHeader :: (Header -> Bool) -> Message -> [Text]

-- | Return True if header is a Message-ID header.
isID :: Header -> Bool

-- | Return True if header is a Date header.
isDate :: Header -> Bool
instance GHC.Show.Show Data.MBox.Message
instance GHC.Read.Read Data.MBox.Message
