asterius
asterius copied to clipboard
putStr does not flush for --browser
Describe the bug
Function putStr
does not produce any output in browser mode if it is not followed by a putStrLn
.
To Reproduce
Create a simple file test.hs
with the following contents:
module Main where
main :: IO ()
main = putStr "42"
Compile with --browser
ahc-link --input-hs test.hs --browser
Run the generated file in the browser. Notice that the console is empty.
Expected behavior
42
should be shown in the console.
Environment
- OS name + version: Ubuntu 18.04.4 LTS (bionic)
- Version of Asterius: current HEAD (https://github.com/tweag/asterius/commit/95020a9a5be2527bfb24acbb96513c62f2c26b40)
Additional context
The above behavior cannot be observed if we replace putStr
with putStrLn
; in that case the output is indeed shown in the console as expected. The issue seems to be similar to https://github.com/tweag/asterius/issues/661 (for node); perhaps the solution to this issue can be based on the solution of #661.