Issue4638.agda 684 B

12345678910111213141516171819202122232425262728
  1. -- The part up to "data D" could be replaced by "open import
  2. -- Common.Prelude", but at the time of writing that seems to slow down
  3. -- the test by something like a factor of two or three (for the GHC
  4. -- backend, on one system).
  5. open import Agda.Builtin.IO
  6. open import Agda.Builtin.String
  7. open import Agda.Builtin.Unit
  8. postulate
  9. putStr : String → IO ⊤
  10. {-# FOREIGN GHC import qualified Data.Text.IO #-}
  11. {-# COMPILE GHC putStr = Data.Text.IO.putStr #-}
  12. {-# COMPILE JS putStr =
  13. function (x) {
  14. return function(cb) {
  15. process.stdout.write(x); cb(0); }; } #-}
  16. data D : Set where
  17. @0 c : D
  18. f : @0 D → String
  19. f c = "Success\n"
  20. main : IO ⊤
  21. main = putStr (f c)