Cannot use my opam-installed Zarith library in utop

I successfully installed the Zarith library with opam, but when I try to use that library
in utop I have a problem :

MBP-de-Jonathan:Ordinary jonathandoyle$ utop
──┬─────────────────────────────────────────────────────────────┬───
│ Welcome to utop version 2.1.0 (using OCaml version 4.06.1)! │
└─────────────────────────────────────────────────────────────┘

Type #utop_help for help about using utop.

─( 16:44:35 )─< command 0 >──────────────────────────{ counter: 0 }─
utop # #directory “/Users/jonathandoyle/.opam/4.06.1/lib/zarith/”;;
─( 16:44:37 )─< command 1 >──────────────────────────{ counter: 0 }─
utop # #load “zarith.cma”;;
─( 16:44:47 )─< command 2 >──────────────────────────{ counter: 0 }─
utop # #show Zarith;;
Unknown element.
─( 16:44:58 )─< command 3 >──────────────────────────{ counter: 0 }─
utop # #show Zarith.Zarith;;
Unknown element.
─( 16:45:04 )─< command 4 >──────────────────────────{ counter: 0 }─
utop #
┌───┬─────┬───────────┬──────────────┬─────────┬────────┬──────┬───┐
│Arg│Array│ArrayLabels│Assert_failure│Big_int_Z│Bigarray│Buffer│Byt│

I think you’re looking for #require "zarith";;

I just tried that, and it has no effect either.
(It goes without saying that I successfully did #use "topfind" just before the #require).

Just FYI, you should not need to #use "topfind" under utop as it does that by default when starting up.

The modules defined by Zarith are called Z and Q. What about #show Z;; ?

1 Like

Works, thank you. Since the library was called zarith.cma, I thought the module was called Zarith.