{-# LANGUAGE CPP #-}
module Distribution.Compat.MonadFail ( MonadFail(fail) ) where
#if __GLASGOW_HASKELL__ >= 800
import Control.Monad.Fail (MonadFail(fail))
#else
import qualified Prelude as P
import Distribution.Compat.Prelude hiding (fail)
import Text.ParserCombinators.ReadP
import Text.ParserCombinators.ReadPrec
class Monad m => MonadFail m where
fail :: String -> m a
instance MonadFail Maybe where
fail _ = Nothing
instance MonadFail [] where
fail _ = []
instance MonadFail P.IO where
fail = P.fail
instance MonadFail ReadPrec where
fail = P.fail
instance MonadFail ReadP where
fail = P.fail
#endif