OCaml: Unbound module Core with ~/.ocamlinit setup

拟墨画扇 提交于 2019-12-12 01:55:15

问题


I have installed a few packages using opam, such as Core and Batteries. The ocamlinit file is as follows:

(* Added by OPAM. *)

#use "topfind"
#thread
#camlp4o
#require "core.top"
#require "core.syntax"
#require "batteries"

let () =
  try Topdirs.dir_directory (Sys.getenv "OCAML_TOPLEVEL_PATH")
  with Not_found -> ()
;;

When I run this with utop I can see the modules for Batteries but I cannot see any of the modules for Core. When I try to do open Core or open Core.Std I get an unbound module error. I also tried adding in #require "core" and the error persisted.

I'm not sure what the error is since I followed the installation instructions from the book "Real World OCaml".

I also see two messages when I start off utop:

No such package: oUnit" - required by `pa_ounit'"
No such package: pa_pipebang" - required by `core.syntax'"

I'm not sure if these are related to the problem but when I do opam list ounit and opam list pipebang it shows them as installed.


回答1:


Ok, I made a fresh install of OCaml and I found out that the problem is indeed related to

No such package: oUnit" - required by `pa_ounit'"
No such package: pa_pipebang" - required by `core.syntax'"

What happened was when I tried to opam install yojson async an error occurred. From that point onward Core didn't load properly.

So I suppose something is wrong with the installation instructions on 'Real World OCaml' for the additional libraries.



来源:https://stackoverflow.com/questions/29225200/ocaml-unbound-module-core-with-ocamlinit-setup

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!