summaryrefslogtreecommitdiff
path: root/src/GF
diff options
context:
space:
mode:
Diffstat (limited to 'src/GF')
-rw-r--r--src/GF/Data/Operations.hs14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/GF/Data/Operations.hs b/src/GF/Data/Operations.hs
index d1a6562c8..551b0f1aa 100644
--- a/src/GF/Data/Operations.hs
+++ b/src/GF/Data/Operations.hs
@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date: 2005/02/24 11:46:35 $
--- > CVS $Author: peb $
--- > CVS $Revision: 1.16 $
+-- > CVS $Date: 2005/03/14 23:45:36 $
+-- > CVS $Author: krijo $
+-- > CVS $Revision: 1.17 $
--
-- some auxiliary GF operations. AR 19\/6\/1998 -- 6\/2\/2001
--
@@ -77,7 +77,7 @@ module Operations (-- * misc functions
import Char (isSpace, toUpper, isSpace, isDigit)
import List (nub, sortBy, sort, deleteBy, nubBy)
-import Monad (liftM2)
+import Monad (liftM2, MonadPlus, mzero, mplus)
infixr 5 +++
infixr 5 ++-
@@ -107,6 +107,12 @@ 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