Issue1126.agda 700 B

1234567891011121314151617181920212223242526272829303132333435
  1. -- Andreas, 2017-07-28, issue #1126 reported by Saizan is fixed
  2. data ℕ : Set where
  3. zero : ℕ
  4. suc : (n : ℕ) → ℕ
  5. {-# BUILTIN NATURAL ℕ #-}
  6. data Unit : Set where
  7. unit : Unit
  8. slow : ℕ → Unit
  9. slow zero = unit
  10. slow (suc n) = slow n
  11. postulate
  12. IO : Set → Set
  13. {-# COMPILE GHC IO = type IO #-}
  14. {-# BUILTIN IO IO #-}
  15. postulate
  16. return : ∀ {A} → A → IO A
  17. {-# COMPILE GHC return = (\ _ -> return) #-}
  18. {-# COMPILE JS return =
  19. function(u0) { return function(u1) { return function(x) { return function(cb) { cb(x); }; }; }; } #-}
  20. force : Unit → IO Unit
  21. force unit = return unit
  22. n = 3000000000
  23. main : IO Unit
  24. main = force (slow n)
  25. -- Should terminate instantaneously.