This commit is contained in:
Matej Kollar 2017-03-03 17:13:11 +01:00
parent c7170f2f89
commit 85614f823f
2 changed files with 4 additions and 4 deletions

View File

@ -19,4 +19,4 @@ runCapitalizeM :: Eff (Capitalize ': r) w -> Eff r w
runCapitalizeM (Val x) = return x runCapitalizeM (Val x) = return x
runCapitalizeM (E u q) = case decomp u of runCapitalizeM (E u q) = case decomp u of
Right (Capitalize s) -> runCapitalizeM (qApp q (map toUpper s)) Right (Capitalize s) -> runCapitalizeM (qApp q (map toUpper s))
Left u' -> E u' (tsingleton (\s -> runCapitalizeM (qApp q s))) Left u' -> E u' (tsingleton (runCapitalizeM . qApp q))

View File

@ -65,9 +65,9 @@ runConsoleM :: Member IO r => Eff (Console ': r) w -> Eff r w
runConsoleM (Val x) = return x runConsoleM (Val x) = return x
runConsoleM (E u q) = case decomp u of runConsoleM (E u q) = case decomp u of
Right (PutStrLn msg) -> send (putStrLn msg) >> runConsoleM (qApp q ()) Right (PutStrLn msg) -> send (putStrLn msg) >> runConsoleM (qApp q ())
Right GetLine -> send getLine >>= \s -> runConsoleM (qApp q s) Right GetLine -> send getLine >>= runConsoleM . qApp q
Right ExitSuccess -> send exitSuccess Right ExitSuccess -> send exitSuccess
Left u' -> E u' (tsingleton (\s -> runConsoleM (qApp q s))) Left u' -> E u' (tsingleton (runConsoleM . qApp q))
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
-- Pure Interpreter for Deeper Stack -- -- Pure Interpreter for Deeper Stack --
@ -89,4 +89,4 @@ runConsolePureM inputs = f (inputs,[]) where
x:s -> f (s,os) (qApp q x) x:s -> f (s,os) (qApp q x)
[] -> error "Not enough lines" [] -> error "Not enough lines"
Right ExitSuccess -> pure (Nothing, st) Right ExitSuccess -> pure (Nothing, st)
Left u' -> E u' (tsingleton (\s -> f st (qApp q s))) Left u' -> E u' (tsingleton (f st . qApp q))