From e4ffd5179740cb5b68f6d96d279bff439b549f44 Mon Sep 17 00:00:00 2001 From: bringert Date: Thu, 20 Dec 2007 17:41:31 +0000 Subject: Moved Err definition to GF.Data.ErrM from GF.Data.Operations. This means the GF-embed does not have to include GF.Data.Operations. --- src/GF/Data/Operations.hs | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) (limited to 'src/GF/Data/Operations.hs') diff --git a/src/GF/Data/Operations.hs b/src/GF/Data/Operations.hs index c6def01a8..1b2033d69 100644 --- a/src/GF/Data/Operations.hs +++ b/src/GF/Data/Operations.hs @@ -80,6 +80,8 @@ import Data.List (nub, sortBy, sort, deleteBy, nubBy) --import Data.FiniteMap import Control.Monad (liftM,liftM2, MonadPlus, mzero, mplus) +import GF.Data.ErrM + infixr 5 +++ infixr 5 ++- infixr 5 ++++ @@ -94,27 +96,6 @@ onSnd f (x, y) = (x, f y) -- the Error monad --- | like @Maybe@ type with error msgs -data Err a = Ok a | Bad String - deriving (Read, Show, Eq) - -instance Monad Err where - return = Ok - fail = Bad - Ok a >>= f = f a - Bad s >>= f = Bad s - --- | added 2\/10\/2003 by PEB -instance Functor Err where - fmap f (Ok a) = Ok (f a) - fmap f (Bad s) = Bad s - --- | added by KJ -instance MonadPlus Err where - mzero = Bad "error (no reason given)" - mplus (Ok a) _ = Ok a - mplus (Bad s) b = b - -- | analogue of @maybe@ err :: (String -> b) -> (a -> b) -> Err a -> b err d f e = case e of -- cgit v1.2.3