{-# LANGUAGE OverloadedStrings #-} module Text.LaTeX.Result ( -- * Result Type Result , toResult , fromResult -- * Special Characters , resCharsStr ) where import Data.Monoid import Data.DString (DString,toString) import Data.String (fromString) -- Result Type -------------- -- Instances needed: Monoid, IsString, ToString -- | The state of the @LaTeX@ monad. A 'Result' is represented by a 'DString'. type Result = DString -- -- | Transform a 'String' to a 'Result'. toResult :: String -> Result toResult = fromString -- | Transform a 'Result' to a 'String'. fromResult :: Result -> String fromResult = toString ------------------------------------ -- | Set of LaTeX reserved characters, and their safe writings as 'Result's. resCharsStr :: [(Char,Result)] resCharsStr = [ ('#',"\\#") , ('$',"\\$") , ('%',"\\%") , ('^',"\\^{}") , ('&',"\\&") , ('_',"\\_") , ('{',"\\{") , ('}',"\\}") , ('~',"\\~{}") , ('\\',"\\textbackslash{}") ]