@@ -35,21 +35,21 @@ readInput inputFiles = forM inputFiles $ \inputFile -> do
3535 text <- readFile inputFile
3636 return (inputFile, text)
3737
38−loadPrelude :: Either String (String, String, P.Environment)
38+loadPrelude :: Either P.MultipleErrors (String, String, P.Environment)
3939loadPrelude =
4040 case P.parseModulesFromFiles id [("", P.prelude)] of
41− Left parseError -> Left (show parseError)
41+ Left parseError -> Left . P.errorMessage . P.ErrorParsingPrelude $ parseError
4242 Right ms -> runReaderT (P.compile (map snd ms) []) $ P.defaultCompileOptions { P.optionsAdditional = P.CompileOptions "Tests" [] [] }
4343
44−compile :: P.Options P.Compile -> [FilePath] -> IO (Either String (String, String, P.Environment))
44+compile :: P.Options P.Compile -> [FilePath] -> IO (Either P.MultipleErrors (String, String, P.Environment))
4545compile opts inputFiles = do
4646 modules <- P.parseModulesFromFiles id <$> readInput inputFiles
4747 case modules of
4848 Left parseError ->
49− return (Left $ show parseError)
49+ return . Left . P.errorMessage . P.ErrorParsingPrelude $ parseError
5050 Right ms -> return $ runReaderT (P.compile (map snd ms) []) opts
5151
52−assert :: FilePath -> P.Options P.Compile -> FilePath -> (Either String (String, String, P.Environment) -> IO (Maybe String)) -> IO ()
52+assert :: FilePath -> P.Options P.Compile -> FilePath -> (Either P.MultipleErrors (String, String, P.Environment) -> IO (Maybe String)) -> IO ()
5353assert preludeExterns opts inputFile f = do
5454 e <- compile opts [preludeExterns, inputFile]
5555 maybeErr <- f e
@@ -64,7 +64,7 @@ assertCompiles preludeJs preludeExterns inputFile = do
6464 { P.optionsMain = Just "Main"
6565 , P.optionsAdditional = P.CompileOptions "Tests" ["Main"] ["Main"]
6666 }
67− assert preludeExterns options inputFile $ either (return . Just) $ \(js, _, _) -> do
67+ assert preludeExterns options inputFile $ either (return . Just . P.prettyPrintMultipleErrors False) $ \(js, _, _) -> do
6868 process <- findNodeProcess
6969 result <- traverse (\node -> readProcessWithExitCode node [] (preludeJs ++ js)) process
7070 case result of
@@ -77,7 +77,7 @@ assertDoesNotCompile preludeExterns inputFile = do
7777 putStrLn $ "Assert " ++ inputFile ++ " does not compile"
7878 assert preludeExterns (P.defaultCompileOptions { P.optionsAdditional = P.CompileOptions "Tests" [] [] }) inputFile $ \e ->
7979 case e of
80− Left err -> putStrLn err >> return Nothing
80+ Left errs -> putStrLn (P.prettyPrintMultipleErrors False errs) >> return Nothing
8181 Right _ -> return $ Just "Should not have compiled"
8282
8383findNodeProcess :: IO (Maybe String)
@@ -88,7 +88,7 @@ main :: IO ()
8888main = do
8989 putStrLn "Compiling Prelude"
9090 case loadPrelude of
91− Left err -> putStrLn err >> exitFailure
91+ Left errs -> putStrLn (P.prettyPrintMultipleErrors False errs) >> exitFailure
9292 Right (preludeJs, exts, _) -> do
9393 tmp <- getTemporaryDirectory
9494 let preludeExterns = tmp ++ pathSeparator : "prelude.externs"