Print module to stderr
authorLuke Lau <luke_lau@icloud.com>
Sun, 10 Mar 2019 01:58:12 +0000 (01:58 +0000)
committerLuke Lau <luke_lau@icloud.com>
Wed, 17 Apr 2019 22:38:30 +0000 (23:38 +0100)
Main.hs

diff --git a/Main.hs b/Main.hs
index 37c6cbc788a9849ef721995f58b9c1191ba0385d..2d838d339da3d1a04c5354fc8e920085aa565d0e 100644 (file)
--- a/Main.hs
+++ b/Main.hs
@@ -5,6 +5,7 @@ module Main where
 import qualified AST
 import qualified Data.Text.Lazy.IO as Text
 import Foreign.Ptr
+import System.IO
 import LLVM.Context
 import LLVM.CodeModel
 import LLVM.ExecutionEngine
@@ -23,7 +24,7 @@ main = do
   ast <- read <$> getContents
   let mdl = buildModule "main" $
         function "expr" [] float $ \_ -> build ast >>= ret
-  Text.putStrLn (ppllvm mdl)
+  Text.hPutStrLn stderr (ppllvm mdl)
   withContext $ \ctx ->
     withMCJIT ctx Nothing Nothing Nothing Nothing $ \mcjit ->
       withModuleFromAST ctx mdl $ \mdl' ->