简体   繁体   English

Ocaml utop库路径,核心模块

[英]Ocaml utop library paths, Core module

I am attempting to use the Core module in utop , as originated by Jane Street and installed using opam . 我试图在utop使用Core模块,由Jane Street创建并使用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. utop似乎没有Core模块的路径。

How do you specify a path that can be found by utop to access the Core module? 如何指定utop可以访问Core模块的路径? Is there a utop init file that specifies library paths ? 是否有指定库路径的utop init文件?

I have the same error message from the OCaml 4.01.0 interpreter. 我从OCaml 4.01.0解释器得到相同的错误消息。

The only way I can avoid this error is actually changing directory to /Users/myname/.opam/system/lib/core . 我可以避免此错误的唯一方法是将目录更改为/Users/myname/.opam/system/lib/core

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 https://github.com/realworldocaml/book/wiki/Installation-Instructions#setting-up-and-using-utop

add the following lines to your ~/.ocamlinit file 将以下行添加到〜/ .ocamlinit文件中

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

Assuming that you have core properly installed through opam: 假设您通过opam正确安装了核心:

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

Should work. 应该管用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM