Commit e1854613 authored by Pavel Zakopaylo's avatar Pavel Zakopaylo

Finished implementation of printResults in Main

parent 86d6b8af
......@@ -50,7 +50,7 @@ main :: IO ()
main = do
inputFiles <- getArgs
b <- GHC.Simple.compileWith compilerConfig compileMu inputFiles
libresults <- return [] -- mapM compileLibraryFiles libraryFiles
libresults <- mapM compileLibraryFiles libraryFiles
case b of
Success results _ _ -> do
doResults lives $ mergeResults $ (loadPrim : concat libresults ++ results')
......@@ -314,23 +314,25 @@ libraryFiles = [ ("ghc-prim", prefix ghcPrimFiles, [])
, "base/Unsafe/Coerce.hs"
]
-- printResult :: CompResult String -> IO ()
-- printResult result = do putStrLn errors
-- putStrLn warnings
-- putStrLn output
-- where
-- (output, errors, warnings) = showResults result
printResult :: CompResult String -> IO ()
printResult result = do putStrLn errors
putStrLn warnings
putStrLn output
where
(output, errors, warnings) = showResults result
-- showResults :: CompResult a -> (String, String, String)
-- showResults results = case results of
-- Success res warns _flags -> (res, showWarns warns, "")
-- Failure warns errors -> ("", showWarns warns, showErrors errors)
-- where
-- showWarns :: [Warning] -> String
-- showWarns = concatMap showIt
-- where
-- showIt (Warning span msg) = show span ++ " " ++ msg
--
-- showErrors :: [Error] -> String
-- showErrors = concatMap showIt
-- where
showResults :: Show a => CompResult a -> (String, String, String)
showResults results = case results of
Success res warns _flags -> (show res, showWarns warns, "")
Failure errors warns -> ("", showWarns warns, showErrors errors)
where
showWarns :: [GHC.Simple.Warning] -> String
showWarns = concatMap showIt
where
showIt (GHC.Simple.Warning span msg) = show span ++ " " ++ msg
showErrors :: [GHC.Simple.Error] -> String
showErrors = concatMap showIt
where
showIt (GHC.Simple.Error span msg info) = show span ++ " " ++ msg ++ " " ++ info
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