Skip to content
This repository was archived by the owner on Nov 24, 2022. It is now read-only.
This repository was archived by the owner on Nov 24, 2022. It is now read-only.

putStr is too lazy #661

Description

@gkaracha

Describe the bug
Function putStr does not behave the same way in Asterius and GHC. For example:

main :: IO ()
main = putStr "a"
-- ghc-custom-asterius-8.8.3
--   a
-- ahc-link:
--       -- nothing here

as opposed to

main :: IO ()
main = putStrLn "a"
-- ghc-custom-asterius-8.8.3:
--   a
-- ahc-link
--   a

Though I thought that maybe putStr is a no-op, this is also not the case. It seems that it works just fine, if another command forces flushing the outputs:

main :: IO ()
main = putStr "a" >> putStrLn "b" >> putStr "c"
-- ghc-custom-asterius-8.8.3
--   ab
--   c
-- ahc-link:
--   ab  -- a is printed!
--       -- nothing here

To Reproduce
Put any of the above snippets in Main.hs, build it with Asterius, and execute using node:

ahc-link --input-hs Main.hs
node Main.mjs

Expected behavior
For all three main functions above, Asterius should give the same output as GHC does.

Environment

  • OS name + version: Ubuntu 18.04.4 LTS (bionic)
  • GHC version: 8.8.3
  • Cabal version: 3.2.0.0
  • Version of Asterius: 20b340f

Additional context
This showed up while developing #640. It seems to be affecting at least three tests (real/symalg, spectral/cichelli, and spectral/primetest).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions