Improve error messages in web-viewer.

This commit is contained in:
David 2019-02-27 12:07:21 +01:00
commit 5a2b679619

View file

@ -49,7 +49,7 @@ generateResponse c conn msg = do
withTempFile ".hs" $ \tmpSource -> withTempFile ".hs" $ \tmpSource ->
withTempDir $ \tmpDir -> do withTempDir $ \tmpDir -> do
writeFile tmpSource $ unlines writeFile tmpSource $ unlines
["{-# LANGUAGE Arrows, OverloadedStrings #-}" ["{-# LANGUAGE Arrows, OverloadedStrings, CPP #-}"
,"module Main where" ,"module Main where"
,"import Reanimate.Arrow" ,"import Reanimate.Arrow"
,"import Reanimate.Combinators" ,"import Reanimate.Combinators"
@ -68,6 +68,7 @@ generateResponse c conn msg = do
," width_, x1_, x2_, x_, y1_, y2_, y_)" ," width_, x1_, x2_, x_, y1_, y2_, y_)"
,"import qualified Lucid.Svg as Lucid" ,"import qualified Lucid.Svg as Lucid"
,"main = renderSvgs animation " ++ show tmpDir ,"main = renderSvgs animation " ++ show tmpDir
,"#line 1 \"animation.hs\""
] ++ T.unpack msg ] ++ T.unpack msg
putStrLn $ "Compiling program:\n" ++ T.unpack msg putStrLn $ "Compiling program:\n" ++ T.unpack msg
ret <- runCmd_ "stack" ["ghc", "--", "-rtsopts", "--make", "-threaded", "-O2", tmpSource, "-o", tmpExecutable] ret <- runCmd_ "stack" ["ghc", "--", "-rtsopts", "--make", "-threaded", "-O2", tmpSource, "-o", tmpExecutable]