Skip to content

Commit

Permalink
fix(library/vm/vm_io): fix io_monad
Browse files Browse the repository at this point in the history
  • Loading branch information
leodemoura committed Mar 27, 2017
1 parent 9e8ef54 commit 70e6c38
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/library/vm/vm_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,11 +281,11 @@ static vm_obj mk_fs() {
return mk_vm_constructor(0, 11, fields);
}

static vm_obj io_return(vm_obj const &, vm_obj const &, vm_obj const & a, vm_obj const &) {
static vm_obj io_return(vm_obj const &, vm_obj const & a, vm_obj const &) {
return mk_io_result(a);
}

static vm_obj io_bind(vm_obj const & /* e */, vm_obj const & /* α */, vm_obj const & /* β */, vm_obj const & a, vm_obj const & b, vm_obj const &) {
static vm_obj io_bind(vm_obj const & /* α */, vm_obj const & /* β */, vm_obj const & a, vm_obj const & b, vm_obj const &) {
vm_obj r = invoke(a, mk_vm_unit());
if (cidx(r) == 0) {
vm_obj v = cfield(r, 0);
Expand All @@ -295,9 +295,10 @@ static vm_obj io_bind(vm_obj const & /* e */, vm_obj const & /* α */, vm_obj co
}
}

static vm_obj io_monad(vm_obj const &, vm_obj const &) {
return get_vm_state().invoke(get_unsafe_monad_from_pure_bind_name(),
{mk_vm_simple(0), mk_native_closure(io_return), mk_native_closure(io_bind)});
static vm_obj io_monad(vm_obj const &) {
vm_state & S = get_vm_state();
vm_obj const & mk_unsafe_monad = S.get_constant(get_unsafe_monad_from_pure_bind_name());
return invoke(mk_unsafe_monad, mk_vm_simple(0), mk_native_closure(io_return), mk_native_closure(io_bind));
}

static vm_obj io_catch(vm_obj const &, vm_obj const &, vm_obj const &, vm_obj const & a, vm_obj const & b, vm_obj const &) {
Expand Down

0 comments on commit 70e6c38

Please sign in to comment.