def0 Unit : ★ = {tt} def drop-unit : 0.(A : ★) → Unit → A → A = λ A u x ⇒ case u return A of {'tt ⇒ x} def0 IO : ★ → ★ = λ A ⇒ IOState → A × IOState def bind : 0.(A B : ★) → IO A → (A → IO B) → IO B = λ A B m k s0 ⇒ case m s0 return B × IOState of { (x, s1) ⇒ k x s1 } def seq : IO Unit → IO Unit → IO Unit = λ a b ⇒ bind Unit Unit a (λ u ⇒ drop-unit (IO Unit) u b) #[compile-scheme "(lambda (n) (builtin-io (printf \"~d~n\" n) 'tt))"] postulate print-ℕ : ℕ → IO Unit #[compile-scheme "(lambda (s) (builtin-io (printf \"~s~n\" s) 'tt))"] postulate print : String → IO Unit load "nat.quox" #[main] def main = seq (print-ℕ (nat.plus 60 9)) (print "(nice)")