1
0
forked from GitHub/gf-core

Fix warnings in 16 modules, mostly forward compatibility warnings from GHC 7.8

This commit is contained in:
hallgren
2014-08-13 22:16:18 +00:00
parent a06351b625
commit cd5193b7e1
16 changed files with 91 additions and 34 deletions

View File

@@ -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