diff options
| author | Jan Tuomi <jans.tuomi@gmail.com> | 2022-02-19 17:06:18 +0200 |
|---|---|---|
| committer | Jan Tuomi <jans.tuomi@gmail.com> | 2022-02-19 17:06:18 +0200 |
| commit | 2bd7673f23bf95a97323c632aeaff35df992c927 (patch) | |
| tree | 0ca1b84695125b126fcf61f52898ad7789476035 /src/Interpreter.hs | |
| parent | e8240a95aed965aa2ba82286283a47ef3afc59ca (diff) | |
Diffstat (limited to 'src/Interpreter.hs')
| -rw-r--r-- | src/Interpreter.hs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/Interpreter.hs b/src/Interpreter.hs index cb71c62..7542fd4 100644 --- a/src/Interpreter.hs +++ b/src/Interpreter.hs @@ -7,6 +7,8 @@ import qualified Data.Map as M import LTypes import Utils +-- | Wait for unbuffered input (any key) from stdin. If 'q', return 'ExecExit', otherwise 'ExecContinue'. +-- If not in debug mode, immediately return 'ExecContinue' without waiting. debugWaitForChar Config {configDebugMode = mode} = do if mode then do @@ -16,11 +18,13 @@ debugWaitForChar Config {configDebugMode = mode} = do _ -> ExecContinue else pure ExecContinue +-- | If in debug mode, print the supplied message, automatically prefixed with "[debug]". Otherwise, no op. debugPrint Config {configDebugMode = mode} message = if mode then liftIO $ putStrLn $ fmt "[debug] %%" [message] else pure () +-- | interpretSource :: Config -> LState -> ExceptT LException IO LState interpretSource config state@LState {lSource = []} = pure state interpretSource config state@LState {lSource = (word : rest)} = do |
