【发布时间】:2014-06-06 22:20:35
【问题描述】:
我正在尝试通过设置 opam、utop 以及核心模块来跟随 Real World OCaml。 I've followed these directions 取得了一些成功。特别是,当我运行 utop 而不指定要加载的文件时,我可以毫无问题地加载 Core:
[dswain@Dupree scratch]$ utop
Welcome to utop version 1.12 (using OCaml version 4.01.0)!
Findlib has been successfully loaded. Additional directives:
...
utop # open Core;;
utop #
到目前为止一切顺利。现在,如果我尝试使用相同的代码从命令行加载脚本:
[dswain@Dupree scratch]$ cat test.ml
open Core.Std;;
[dswain@Dupree scratch]$ utop test.ml
File "test.ml", line 1, characters 0-13:
Error: Unbound module Core
[dswain@Dupree scratch]$
我认为这是我在某处犯的配置错误,但我不太确定在哪里。
设置详情
我尝试重新安装 ocaml、opam、utop 和 core 均无济于事。我知道opam init 在设置过程中进行了以下配置更改:
~/.ocamlinit:
#use "topfind";;
#thread;;
#camlp4o;;
#require "core.top";;
#require "core.syntax";;
~/.bash_profile
# OPAM configuration
. /home/dswain/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true
eval `opam config env`
我正在运行 Arch Linux,并按照步骤通过 AUR 安装 opam,没有发现任何问题。我还能够根据安装说明构建和安装所有软件包,而没有任何我知道的错误。
【问题讨论】: