From cd5193b7e19e7ff5e49cdeafe149fdeec8e19fb0 Mon Sep 17 00:00:00 2001 From: hallgren Date: Wed, 13 Aug 2014 22:16:18 +0000 Subject: Fix warnings in 16 modules, mostly forward compatibility warnings from GHC 7.8 --- src/compiler/GF/Data/ErrM.hs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/compiler/GF/Data/ErrM.hs') diff --git a/src/compiler/GF/Data/ErrM.hs b/src/compiler/GF/Data/ErrM.hs index e8cea12d4..d687a70a5 100644 --- a/src/compiler/GF/Data/ErrM.hs +++ b/src/compiler/GF/Data/ErrM.hs @@ -14,7 +14,8 @@ module GF.Data.ErrM (Err(..)) where -import Control.Monad (MonadPlus(..)) +import Control.Monad (MonadPlus(..),ap) +import Control.Applicative -- | like @Maybe@ type with error msgs data Err a = Ok a | Bad String @@ -31,8 +32,16 @@ instance Functor Err where fmap f (Ok a) = Ok (f a) fmap f (Bad s) = Bad s +instance Applicative Err where + pure = return + (<*>) = ap + -- | added by KJ instance MonadPlus Err where mzero = Bad "error (no reason given)" mplus (Ok a) _ = Ok a mplus (Bad s) b = b + +instance Alternative Err where + empty = mzero + (<|>) = mplus -- cgit v1.2.3