{-# LANGUAGE OverloadedStrings #-}

module Text.LaTeX.Result (
     -- * Result Type
     Result
   , toResult
   , fromResult
     -- * Special Characters
   , resCharsStr
   ) where
import Data.Monoid

import Data.DString (DString)
import Data.String.ToString (toString)
import GHC.Exts (fromString)

import Data.String.Combinators

-- Result Type
--------------
-- Instances needed: Monoid, IsString, ToString

type Result = DString

--

toResult :: String -> Result
toResult = fromString

fromResult :: Result -> String
fromResult = toString

------------------------------------

resCharsStr :: [(Char,Result)]
resCharsStr = [ ('#',"\\#")
              , ('$',"\\$")
              , ('%',"\\%")
              , ('^',"\\^{}")
              , ('&',"\\&")
              , ('_',"\\_")
              , ('{',"\\{")
              , ('}',"\\}")
              , ('~',"\\~{}")
              , ('\\',"\\textbackslash") ]