Invalidate on :load
This commit is contained in:
@@ -208,6 +208,9 @@ showErrors fn src = do
|
|||||||
exitFailure "Compile failed"
|
exitFailure "Compile failed"
|
||||||
pure MkUnit
|
pure MkUnit
|
||||||
|
|
||||||
|
invalidateModule : QName -> M Unit
|
||||||
|
invalidateModule (QN ns nm) = modifyTop [modules $= deleteMap (snoc ns nm)]
|
||||||
|
|
||||||
-- processFile called on the top level file
|
-- processFile called on the top level file
|
||||||
-- it sets up everything and then recurses into processModule
|
-- it sets up everything and then recurses into processModule
|
||||||
processFile : String -> M Unit
|
processFile : String -> M Unit
|
||||||
@@ -239,6 +242,8 @@ processFile fn = do
|
|||||||
let modules = updateMap primNS (MkModCtx "" top.defs (MC emptyMap Nil 0 CheckAll) top.ops Nil) top.modules
|
let modules = updateMap primNS (MkModCtx "" top.defs (MC emptyMap Nil 0 CheckAll) top.ops Nil) top.modules
|
||||||
modifyTop (\ top => MkTop modules (primNS :: Nil) emptyMap Nil emptyMap top.metaCtx top.verbose top.errors top.ops)
|
modifyTop (\ top => MkTop modules (primNS :: Nil) emptyMap Nil emptyMap top.metaCtx top.verbose top.errors top.ops)
|
||||||
|
|
||||||
|
invalidateModule qn
|
||||||
|
|
||||||
src <- processModule emptyFC base Nil qn
|
src <- processModule emptyFC base Nil qn
|
||||||
top <- getTop
|
top <- getTop
|
||||||
|
|
||||||
@@ -305,16 +310,21 @@ runCommand (Verbose Nothing) = modifyTop [ verbose $= _+_ 1 ]
|
|||||||
runCommand (Verbose (Just v)) = modifyTop [ verbose := v ]
|
runCommand (Verbose (Just v)) = modifyTop [ verbose := v ]
|
||||||
runCommand (OutputJS fn) = writeSource fn
|
runCommand (OutputJS fn) = writeSource fn
|
||||||
|
|
||||||
|
-- Broken out to a separate function so I can hook it.
|
||||||
|
runString : String → M Unit
|
||||||
|
runString line = do
|
||||||
|
let (Right toks) = tokenise "<stdin>" line
|
||||||
|
| Left err => putStrLn (showError line err)
|
||||||
|
let (Right cmd) = parse "<stdin>" parseCommand toks
|
||||||
|
| Left err => putStrLn (showError line err)
|
||||||
|
catchError (runCommand cmd) (\ err => putStrLn $ showError line err)
|
||||||
|
|
||||||
runRepl : M Unit
|
runRepl : M Unit
|
||||||
runRepl = do
|
runRepl = do
|
||||||
liftIO $ putStr "> "
|
liftIO $ putStr "> "
|
||||||
Right line <- liftIO {M} $ readLine
|
Right line <- liftIO {M} $ readLine
|
||||||
| Left err => pure MkUnit
|
| Left err => pure MkUnit
|
||||||
let (Right toks) = tokenise "<stdin>" line
|
runString line
|
||||||
| Left err => putStrLn (showError line err) >> runRepl
|
|
||||||
let (Right cmd) = parse "<stdin>" parseCommand toks
|
|
||||||
| Left err => putStrLn (showError line err) >> runRepl
|
|
||||||
catchError (runCommand cmd) (\ err => putStrLn $ showError line err)
|
|
||||||
runRepl
|
runRepl
|
||||||
|
|
||||||
-- TODO translate args into REPL commands?
|
-- TODO translate args into REPL commands?
|
||||||
|
|||||||
Reference in New Issue
Block a user