All pastes #836098 Raw Edit

broken_code_sad

public text v1 · immutable
#836098 ·published 2007-12-29 05:53 UTC
rendered paste body
--So this code doesn't work . I'm confused as to why.
module ProcessMail (processMail,printMail,fixEol,module Text.ParserCombinators.Parsec, module Text.ParserCombinators.Parsec.Rfc2822 ) where

-- Load the parser!
import Text.ParserCombinators.Parsec ( parse )
import Text.ParserCombinators.Parsec.Rfc2822

printMail input = do 
    print (processMail input)

processMail input = do
    return (parse message ""  (fixEol input))

-- Make sure all lines are terminated by CRLF.

fixEol :: String -> String
fixEol ('\r':'\n':xs)   = '\r' : '\n' : (fixEol xs)
fixEol ('\n':xs)        = '\r' : '\n' : (fixEol xs)
fixEol (x:xs)           = x : (fixEol xs)
fixEol []               = []