test(tests/lean/run): add another IO test

This commit is contained in:
Leonardo de Moura 2016-05-25 14:23:57 -07:00
parent b8ea69b3cd
commit 2a16b58324
2 changed files with 14 additions and 1 deletions

View file

@ -3,7 +3,7 @@ Copyright (c) 2016 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Luke Nelson, Jared Roesch and Leonardo de Moura
-/
constant IO : Type → Type
constant IO : Type → Type
constant functorIO : functor IO
constant monadIO : monad IO

13
tests/lean/run/IO2.lean Normal file
View file

@ -0,0 +1,13 @@
import system.IO data.list
open list
/- B and unit must be in the same universe
So, we must put B at Type₁ or use poly_unit
since unit is at Type₁
-/
definition for {A : Type} {B : Type} : list A → (A → IO B) → IO poly_unit
| [] f := return poly_unit.star
| (x::xs) f := do f x, for xs f
vm_eval for [1,2,3,4,5] (λ i, do put_str "value: ", put_nat i, put_str "\n")