tweag/asterius

putStr does not flush for --browser

gkaracha opened this issue · 0 comments

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 (95020a9)

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 #661 (for node); perhaps the solution to this issue can be based on the solution of #661.