Ocaml utop library paths, Core module

五迷三道 提交于 2019-12-05 14:36:00

问题


I am attempting to use the Core module in utop, as originated by Jane Street and installed using opam.

Here's the problem

utop # open Core.Std;;
Error: Unbound module Core

utop does not seem to have the path to the Core module.

How do you specify a path that can be found by utop to access the Core module? Is there a utop init file that specifies library paths ?

I have the same error message from the OCaml 4.01.0 interpreter.

The only way I can avoid this error is actually changing directory to /Users/myname/.opam/system/lib/core.


回答1:


I had the same problem, the directions here got it working for me.

https://github.com/realworldocaml/book/wiki/Installation-Instructions#setting-up-and-using-utop

add the following lines to your ~/.ocamlinit file

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



回答2:


Assuming that you have core properly installed through opam:

# require "core";;
open Core.Std;;

Should work.



来源:https://stackoverflow.com/questions/20927592/ocaml-utop-library-paths-core-module

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