git.iko.soy/typeable/pandoc
on master help sign in
Except Compat: Updated to export more module functions
b57e554Matthew Pickering
src/Text/Pandoc/Compat/Except.hs+11−1
@@ -1,7 +1,10 @@
1{-# LANGUAGE CPP #-}
1{-# LANGUAGE CPP #-}
2module Text.Pandoc.Compat.Except ( ExceptT
2module Text.Pandoc.Compat.Except ( ExceptT
3+ , Except
3 , Error(..)
4 , Error(..)
4 , runExceptT
5 , runExceptT
6+ , runExcept
7+ , MonadError
5 , throwError
8 , throwError
6 , catchError )
9 , catchError )
7 where
10 where
@@ -18,10 +21,17 @@ class Error a where
18
21
19#else
22#else
20import Control.Monad.Error
23import Control.Monad.Error
24+import Control.Monad.Identity (Identity, runIdentity)
25+
21type ExceptT = ErrorT
26type ExceptT = ErrorT
22
27
28+type Except s a = ErrorT s Identity a
29+
23−runExceptT :: ExceptT e m a -> m (Either e a)
30+runExceptT :: ExceptT e m a -> m (Either e a)
24runExceptT = runErrorT
31runExceptT = runErrorT
32+
33+runExcept :: ExceptT e Identity a -> Either e a
34+runExcept = runIdentity . runExceptT
25#endif
35#endif
26
36
27
37