From fe2eda9d54e64ffa0c6c5c5295c19941040a5f3d Mon Sep 17 00:00:00 2001 From: Jesse Rosenthal Date: Sat, 12 Jul 2014 08:56:59 +0100 Subject: Docx Reader: Add a compatibility layer for Except. mtl switched from ErrorT to ExceptT, but we're not sure which mtl we'll be dealing with. This should make errors work with both. The main difference (beside the name of the module and the monad transformer) is that Except doesn't require an instance of an Error Typeclass. So we define that for compatability. When we switch to a later mtl, using Control.Monad.Exception, we can just erase the instance declaration, and all should work fine. --- src/Text/Pandoc/Readers/Docx/Parse.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/Text/Pandoc/Readers') diff --git a/src/Text/Pandoc/Readers/Docx/Parse.hs b/src/Text/Pandoc/Readers/Docx/Parse.hs index bb65236a3..4b5a11fa8 100644 --- a/src/Text/Pandoc/Readers/Docx/Parse.hs +++ b/src/Text/Pandoc/Readers/Docx/Parse.hs @@ -69,7 +69,7 @@ import qualified Data.ByteString.Lazy as B import qualified Text.Pandoc.UTF8 as UTF8 import Control.Monad.Reader import qualified Data.Map as M -import Control.Monad.Error +import Text.Pandoc.Compat.Except data ReaderEnv = ReaderEnv { envNotes :: Notes , envNumbering :: Numbering @@ -84,10 +84,10 @@ data DocxError = DocxError | WrongElem instance Error DocxError where noMsg = WrongElem -type D = ErrorT DocxError (Reader ReaderEnv) +type D = ExceptT DocxError (Reader ReaderEnv) runD :: D a -> ReaderEnv -> Either DocxError a -runD dx re = runReader (runErrorT dx ) re +runD dx re = runReader (runExceptT dx ) re maybeToD :: Maybe a -> D a maybeToD (Just a) = return a -- cgit v1.2.3