summaryrefslogtreecommitdiff
path: root/src/GF/Data/Operations.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/GF/Data/Operations.hs')
-rw-r--r--src/GF/Data/Operations.hs23
1 files changed, 2 insertions, 21 deletions
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