Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ocaml utop library paths, Core module

Tags:

ocaml

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.

like image 679
user3161399 Avatar asked Jan 04 '14 22:01

user3161399


2 Answers

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";;
like image 67
Kris Kuhlman Avatar answered Oct 24 '22 10:10

Kris Kuhlman


Assuming that you have core properly installed through opam:

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

Should work.

like image 13
rgrinberg Avatar answered Oct 24 '22 10:10

rgrinberg