ocaml / oloop

Evaluate code through the OCaml toploop for inclusion in educational material.
ISC License
12 stars 5 forks source link

fatal error using oloop from utop #19

Closed agarwal closed 9 years ago

agarwal commented 9 years ago

If I opam install oloop and try to use it from utop, it works fine:

$ utop
utop # #require "oloop";;
utop # open Core.Std;;
utop # open Async.Std;;
utop # let f() = Oloop.(with_toploop Output.merged ~f:(fun t -> eval t "2+3" >>| fun _ -> Ok ()));;
val f : unit -> unit Async_kernel.Std.Deferred.Or_error.t = <fun>

However, launching utop from within my working directory, I get a fatal error. Note, this ends up using the .ocamlinit file checked into the repo.

$ utop
utop # let f() = Oloop.(with_toploop Output.merged ~f:(fun t -> eval t "2+3" >>| fun _ -> Ok ()));;
>> Fatal error: f unbound at toplevel
Fatal error: exception Misc.Fatal_error
Raised at file "map.ml", line 117, characters 16-25 
Chris00 commented 9 years ago

This has nothing to do with oloop. This is because you load compiler-libs.toplevel but they are already included in the toplevel — thus the conflict. It does not matter the binding you make.