diff options
Diffstat (limited to 'src/compiler/GF/Data')
| -rw-r--r-- | src/compiler/GF/Data/Operations.hs | 5 | ||||
| -rw-r--r-- | src/compiler/GF/Data/Utilities.hs | 6 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/compiler/GF/Data/Operations.hs b/src/compiler/GF/Data/Operations.hs index 044dc06df..52632c163 100644 --- a/src/compiler/GF/Data/Operations.hs +++ b/src/compiler/GF/Data/Operations.hs @@ -20,7 +20,7 @@ module GF.Data.Operations ( lookupErr, -- ** Error monad class - ErrorMonad(..), checks, doUntil, --allChecks, checkAgain, + ErrorMonad(..), checks, --doUntil, allChecks, checkAgain, liftErr, -- ** Checking @@ -363,10 +363,11 @@ allChecks :: ErrorMonad m => [m a] -> m [a] allChecks ms = case ms of (m: ms) -> let rs = allChecks ms in handle_ (liftM2 (:) m rs) rs _ -> return [] --} + doUntil :: ErrorMonad m => (a -> Bool) -> [m a] -> m a doUntil cond ms = case ms of a:as -> do v <- a if cond v then return v else doUntil cond as _ -> raise "no result" +-}
\ No newline at end of file diff --git a/src/compiler/GF/Data/Utilities.hs b/src/compiler/GF/Data/Utilities.hs index 792f7aa4a..eac315508 100644 --- a/src/compiler/GF/Data/Utilities.hs +++ b/src/compiler/GF/Data/Utilities.hs @@ -16,7 +16,7 @@ module GF.Data.Utilities(module GF.Data.Utilities, module PGF.Utilities) where import Data.Maybe import Data.List -import Control.Monad (MonadPlus(..),liftM) +import Control.Monad (MonadPlus(..),liftM,when) import PGF.Utilities -- * functions on lists @@ -136,6 +136,10 @@ mapBoth = map . apBoth whenMP :: MonadPlus m => Bool -> a -> m a whenMP b x = if b then return x else mzero +whenM bm m = flip when m =<< bm + +repeatM m = whenM m (repeatM m) + -- * functions on Maybes -- | Returns true if the argument is Nothing or Just [] |
