aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Compat/Except.hs
blob: 7f5648e7ab097705d045f6ae6f884a0a8aebea56 (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
{-# 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