Commit b03d81a7 authored by Marc André Wittorf's avatar Marc André Wittorf

Type evaluation (:t command) now works even after loading an invalid module. Close #55

parent 4683b2e0
Pipeline #235 canceled with stage
......@@ -48,6 +48,8 @@ printLoadMessage (DirectMessage m) = m
--for proper putStrLn
loadInitialModules :: Repl ()
loadInitialModules = do
ps <- liftIO initEmptyTI
tiProg .= ps
Just level <- use forceLevel `mplusM` return (Just Level1)
currentLevel .= level
liftInterpreter $ setImportsQ [("Prelude", Nothing),
......@@ -141,7 +143,9 @@ loadModule fname = MC.handleAll handler $ loadModule' $ adjustPath fname
if null errors || (nonstrict && not (any isCritical errors'))
then let dm e = DirectMessage $ adjustGHCerror transModule $ displayException e
handler' e = return $ levelSelectErrors ++
handler' e = do
loadInitialModules
return $ levelSelectErrors ++
errors ++
[dm e]
in MC.handleAll handler' $ do
......@@ -156,7 +160,8 @@ loadModule fname = MC.handleAll handler $ loadModule' $ adjustPath fname
return $ levelSelectErrors ++
errors ++
map DirectMessage testErrors
else
else do
loadInitialModules
return $ levelSelectErrors ++ errors
--adjusts path for easier usage (appends .hs suffix)
adjustPath :: FilePath -> FilePath
......
......@@ -54,8 +54,6 @@ initInterpreter = do
datadir <- liftIO getDataDir
liftInterpreter $ Language.Haskell.Interpreter.set
[searchPath := [".", datadir </> "TargetModules"]]
ps <- liftIO initEmptyTI
tiProg .= ps
loadInitialModules
main :: IO ()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment