diff options
| author | Jan Tuomi <jans.tuomi@gmail.com> | 2022-10-06 12:28:24 +0300 |
|---|---|---|
| committer | Jan Tuomi <jans.tuomi@gmail.com> | 2022-12-05 14:21:53 +0200 |
| commit | 77117fa515c5853b5f756d899db0ec9b502298e7 (patch) | |
| tree | 43e6ad438b315debae335b0d9e74b8f7f21bb1d8 /src/Utils.hs | |
| parent | d69313ce44a9415555033926c6a64b4120455502 (diff) | |
Add line info to REPL
Diffstat (limited to 'src/Utils.hs')
| -rw-r--r-- | src/Utils.hs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/Utils.hs b/src/Utils.hs index ec8cfc8..4421f8a 100644 --- a/src/Utils.hs +++ b/src/Utils.hs @@ -30,6 +30,8 @@ data LState = LState { stateDepth :: Int } +type LineNo = Int + type LContext a = StateT LState (ExceptT LException IO) a runL :: LState -> LContext a -> IO (Either LException (a, LState)) @@ -58,6 +60,10 @@ incrementDepth :: LContext () incrementDepth = modify (\s -> s { stateDepth = stateDepth s + 1 }) +decrementDepth :: LContext () +decrementDepth = + modify (\s -> s { stateDepth = stateDepth s - 1 }) + getDepth :: LContext Int getDepth = do s <- get |
