blob: 5c1214f47c238f8d94d8c17ba52abda5ab23cd3b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
{-# LANGUAGE CPP #-}
module Text.Pandoc.Compat.Except ( ExceptT
, Except
, Error(..)
, runExceptT
, runExcept
, MonadError
, throwError
, catchError )
where
import Prelude
#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
import Control.Monad.Identity (Identity, runIdentity)
type ExceptT = ErrorT
type Except s a = ErrorT s Identity a
runExceptT :: ExceptT e m a -> m (Either e a)
runExceptT = runErrorT
runExcept :: ExceptT e Identity a -> Either e a
runExcept = runIdentity . runExceptT
#endif
|