aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Compat/Except.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-07-12 14:06:29 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2014-07-12 14:06:29 -0700
commit6c4345aa0bbdc963e1a1c9a9ea2a55e3682a1fa5 (patch)
tree9c2c736c1f60d564e13d088f1b9ccb672499dd80 /src/Text/Pandoc/Compat/Except.hs
parent0756616241081c6f902a78c2e451be1c9b9173de (diff)
parentfe2eda9d54e64ffa0c6c5c5295c19941040a5f3d (diff)
downloadpandoc-6c4345aa0bbdc963e1a1c9a9ea2a55e3682a1fa5.tar.gz
Merge pull request #1415 from jkr/nicertype
Nicer Docx type
Diffstat (limited to 'src/Text/Pandoc/Compat/Except.hs')
-rw-r--r--src/Text/Pandoc/Compat/Except.hs27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Compat/Except.hs b/src/Text/Pandoc/Compat/Except.hs
new file mode 100644
index 000000000..7f5648e7a
--- /dev/null
+++ b/src/Text/Pandoc/Compat/Except.hs
@@ -0,0 +1,27 @@
+{-# LANGUAGE CPP #-}
+module Text.Pandoc.Compat.Except ( ExceptT
+ , Error(..)
+ , runExceptT
+ , throwError
+ , catchError )
+ where
+
+#if MIN_VERSION_mtl(2,2,1)
+import Control.Monad.Except
+
+class Error a where
+ noMsg :: a
+ strMsg :: String -> a
+
+ noMsg = strMsg ""
+ strMsg _ = noMsg
+
+#else
+import Control.Monad.Error
+type ExceptT = ErrorT
+
+runExceptT :: ExceptT e m a -> m (Either e a)
+runExceptT = runErrorT
+#endif
+
+