I’ve just installed opam and ocaml on Debian Testing via apt, then did
opam install utop, added ``eval `opam config env``` to my ~/.bashrc, and I can now start up and use utop as a calculator.
Utop tells me the versions I have are:
Welcome to utop version 2.0.1 (using OCaml version 4.02.3)
I wanted to install Core (to follow along with RWO), and did
opam install core to get it. It downloaded and installed a bunch of packages, and seemed to have succeeded. If I try installing again, I get:
$ opam install core
[NOTE] Package core is already installed (current version is 113.33.03).
Now when I start utop and do “
open Core.Std;;”, it tells me “
Error: Unbound module Core”.
Did I install Core correctly?
Is there some other config to be done to get Core properly installed?
You have to first load the libraries you want to use. First do
#require "core", and then
open Core should work. (Note it is now simply
open Core instead of
Thanks, ashish. This seems to work:
Why does “require” have the pound sign but “open” does not?
#require is a toplevel directive. There are several other useful directives. Type
#help to see them all:
utop # #help;;
General #help Prints a list of all available directives, with corresponding argument type
Exit the toplevel.
Change the current working directory.
Add the given directory to search path for source and compiled files.
Load in memory a bytecode object, produced by ocamlc.
As #load, but loads dependencies recursively.
Usage is identical to #use but #mod_use wraps the contents in a module.
Remove the given directory from the search path.
Read, compile and execute source phrases from the given file.
Print the signatures of components from any of the above categories.
Print the signature of the corresponding class.
Print the signature of the corresponding class type.
Print the signature of the corresponding exception.
Print the signature of the corresponding module.
Print the signature of the corresponding module type.
Print the signature of the corresponding type constructor.
Print the signature of the corresponding value.
Registers a printer for values of a certain type.
Limit the printing of values to a maximal depth of n.
Limit the number of value nodes printed to at most n.
Remove the named function from the table of toplevel printers.
All calls to the function named function-name will be traced.
Stop tracing the given function.
Stop tracing all functions traced so far.
Choose whether to ignore labels in function types.
After parsing, pipe the abstract syntax tree through the preprocessor
Make sure that all types are derived in a principal way.
Allow arbitrary recursive types during type-checking.
Treat as errors the warnings enabled by the argument.
Enable or disable warnings according to the argument.
#help;; doesn’t get me that display:
utop # #help;;
Unknown directive `help'.
How can I get it to display those directives?
Strange. I’m on the same version of utop as you. Not sure why it wouldn’t work.
Just to add another data point, I’m on utop 1.19.3 and
#help;; gives me the same error message as it does @uvtc.