From 77117fa515c5853b5f756d899db0ec9b502298e7 Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Thu, 6 Oct 2022 12:28:24 +0300 Subject: Add line info to REPL --- src/Utils.hs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/Utils.hs') 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 -- cgit v1.3