Commit 0a1bb436 authored by Marc André Wittorf's avatar Marc André Wittorf

Prettified type errors shown when evaluating an expression or querying an...

Prettified type errors shown when evaluating an expression or querying an expression's type in repl.
parent cf7d3db7
Pipeline #223 failed with stage
......@@ -119,11 +119,19 @@ replEvalExp q = case filter (not . isSpace) q of
p' <- use tiProg
case p' of
[] -> return Nothing
ps -> case parseExp q of
ps -> case parseExpWithMode (defaultParseMode{parseFilename = "<interactive>"}) q of
ParseFailed _ f -> return $ Just f
ParseOk e ->
case inferHSEExp ps e of
Left e -> return $ Just $ showTIError defaultAHOptions e
Left e -> return $ Just
$ showTIError
defaultAHOptions {
unqModules =
"Prelude" :
unqModules
defaultAHOptions
}
e
Right e -> return Nothing
replEvalCommand :: String -> Repl (Maybe String, Bool)
......@@ -181,11 +189,18 @@ commandTypeof args = do
p' <- use tiProg
case p' of
[] -> return (Nothing, True)
ps -> case parseExp expression of
ps -> case parseExpWithMode (defaultParseMode{parseFilename = "<interactive>"}) expression of
ParseFailed _ f -> return (Just f, True)
ParseOk e ->
case inferHSEExp ps e of
Left e -> return (Just $ show e, True)
Left e -> return (Just $ showTIError
defaultAHOptions {
unqModules =
"Prelude" :
unqModules
defaultAHOptions
}
e, True)
Right e -> return (Just
(expression ++
" :: " ++
......
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