diff options
| author | hallgren <hallgren@chalmers.se> | 2015-08-13 10:49:50 +0000 |
|---|---|---|
| committer | hallgren <hallgren@chalmers.se> | 2015-08-13 10:49:50 +0000 |
| commit | 87e64a804cbe5848d20f0555dedae42e1516cbbc (patch) | |
| tree | 743ba4592624e9947dcf56945eb76c9dacc0393e /src/compiler/GF/Data/Operations.hs | |
| parent | d860a921e061ca21e7af8c1c42f5bbca4bd5c988 (diff) | |
GF Shell: refactoring for improved modularity and reusability:
+ Generalize the CommandInfo type by parameterizing it on the monad
instead of just the environment.
+ Generalize the commands defined in
GF.Command.{Commands,Commands2,CommonCommands,SourceCommands,HelpCommand}
to work in any monad that supports the needed operations.
+ Liberate GF.Command.Interpreter from the IO monad.
Also, move the current PGF from CommandEnv to GFEnv in
GF.Interactive, making the command interpreter even more generic.
+ Use a state monad to maintain the state of the interpreter in
GF.{Interactive,Interactive2}.
Diffstat (limited to 'src/compiler/GF/Data/Operations.hs')
| -rw-r--r-- | src/compiler/GF/Data/Operations.hs | 5 |
1 files changed, 3 insertions, 2 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 |
