diff options
| author | Andreas Källberg <anka.213@gmail.com> | 2020-08-05 16:20:35 +0200 |
|---|---|---|
| committer | Andreas Källberg <anka.213@gmail.com> | 2020-08-05 18:48:24 +0200 |
| commit | 251845f83ea52965b5205fd231ffa2c87bb34de6 (patch) | |
| tree | 66b22f4370f09b673a44607ed1b0cc1294a2f74e /src/tools/c/GFCC/ErrM.hs | |
| parent | deddde953f9e9b71e35a80bb29af0ce81e1dc6d0 (diff) | |
First attempt at fixing incompabilities with newer cabal
Diffstat (limited to 'src/tools/c/GFCC/ErrM.hs')
| -rw-r--r-- | src/tools/c/GFCC/ErrM.hs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/tools/c/GFCC/ErrM.hs b/src/tools/c/GFCC/ErrM.hs index 820473ccd..78295d30e 100644 --- a/src/tools/c/GFCC/ErrM.hs +++ b/src/tools/c/GFCC/ErrM.hs @@ -4,6 +4,10 @@ -- This file comes with NO WARRANTY and may be used FOR ANY PURPOSE. module GFCC.ErrM where +-- Control.Monad.Fail import will become redundant in GHC 8.8+ +import qualified Control.Monad.Fail as Fail + + -- the Error monad: like Maybe type with error msgs data Err a = Ok a | Bad String @@ -11,6 +15,13 @@ data Err a = Ok a | Bad String instance Monad Err where return = Ok - fail = Bad Ok a >>= f = f a Bad s >>= f = Bad s + +#if !(MIN_VERSION_base(4,13,0)) + fail = Bad +#endif + +instance Fail.MonadFail Err where + fail = Bad + |
