Improve error message printing

- Omit unnecessary show-invocation
- Use showOutputable for the error span (location)

before/after:

  "RealSrcSpan SrcSpanPoint \"stdin\" 2 1: parse error (possibly incorrect indentation or mismatched brackets)"
  stdin:2:1: parse error (possibly incorrect indentation or mismatched brackets)
pull/273/head
Lennart Spitzner 2020-01-03 11:58:53 +01:00
parent af227a797d
commit 342cf16c56
2 changed files with 2 additions and 2 deletions

View File

@ -325,7 +325,7 @@ coreIO putErrorLnIO config suppressOutput inputPathM outputPathM =
case parseResult of case parseResult of
Left left -> do Left left -> do
putErrorLn "parse error:" putErrorLn "parse error:"
putErrorLn $ show left putErrorLn left
ExceptT.throwE 60 ExceptT.throwE 60
Right (anns, parsedSource, hasCPP) -> do Right (anns, parsedSource, hasCPP) -> do
(inlineConf, perItemConf) <- (inlineConf, perItemConf) <-

View File

@ -123,7 +123,7 @@ parseModuleFromString args fp dynCheck str =
dynCheckRes <- ExceptT.ExceptT $ liftIO $ dynCheck dflags1 dynCheckRes <- ExceptT.ExceptT $ liftIO $ dynCheck dflags1
let res = ExactPrint.parseModuleFromStringInternal dflags1 fp str let res = ExactPrint.parseModuleFromStringInternal dflags1 fp str
case res of case res of
Left (span, err) -> ExceptT.throwE $ show span ++ ": " ++ err Left (span, err) -> ExceptT.throwE $ showOutputable span ++ ": " ++ err
Right (a , m ) -> pure (a, m, dynCheckRes) Right (a , m ) -> pure (a, m, dynCheckRes)