Issue2921.agda 610 B

1234567891011121314151617181920212223
  1. open import Agda.Builtin.IO
  2. open import Agda.Builtin.Unit
  3. open import Agda.Builtin.Nat
  4. data Unit : Set where
  5. c : ⊤ → Nat → ⊤ → Unit
  6. -- Note that the ⊤ arguments do not get erased and should be present in
  7. -- the Haskell version of Unit.
  8. {-# FOREIGN GHC data Unit = Unit () Integer () #-}
  9. {-# COMPILE GHC Unit = data Unit (Unit) #-}
  10. postulate print : Nat → IO ⊤
  11. {-# COMPILE GHC print = print #-}
  12. {-# COMPILE JS print = function (x) { return function(cb) { process.stdout.write(x + "\n"); cb(0) } } #-}
  13. foo : Unit → IO ⊤
  14. foo (c _ n _) = print n
  15. main : IO ⊤
  16. main = foo (c _ 12345 _)