Questions tagged [utop]

utop (Universal toplevel) is an improved toplevel (REPL) for OCaml. Not to be confused with [tag:ocaml-toplevel] which ships with the OCaml compiler.

utop is an improved toplevel for . It can run in a terminal or in . It supports line editing, history, real-time and context sensitive completion, colors, and more.

Useful resources

93 questions
1
vote
0 answers

Running utop with dune conflict: extlib and base64

I have a project which uses extlib and base64. dune is used in the build process. The build works fine, but when I try to run dune utop, I get the following message: [@ js2sil]$ dune utop File…
avery_laird
  • 146
  • 9
1
vote
2 answers

Ocaml Lwt type confusion

I'm confused why the Lwt print function Lwt_io.print has type string -> unit Lwt.t But if I run Lwt_io.print "a" >>= fun () -> Lwt_io.print "b";; the result is that "ab" is printed and type unit is returned. I would imagine that this would be a…
Ryan Marr
  • 83
  • 7
1
vote
1 answer

use fully qualified names in utop

I want to launch utop in a directory containing a.ml (which has a definition for something) and be able to enter A.something in utop. I know I can do #use "a.ml", but that pollutes the global namespace. How can I make the fully qualified name…
Mei Zhang
  • 1,434
  • 13
  • 29
1
vote
0 answers

Source location for a type definition from utop

In utop, can I get the source location for the definition of the type, say, result ? utop # #show_type result;; type nonrec ('a, 'b) result = ('a, 'b) result = Ok of 'a | Error of 'b (defined in pervasives Result type type ('a, 'b) result = | Ok…
nicolas
  • 9,549
  • 3
  • 39
  • 83
1
vote
1 answer

How to move the OPAM root?

Is it possible to move the OPAM root? Or, to create a "portable" (in the sense of e.g. "firefox portable") version of an OPAM root? That is, install a bunch of packages via opam --root=/PATH/TO/A, then move /PATH/TO/A to /ANOTHER/PATH/TO/B, and run…
vog
  • 23,517
  • 11
  • 59
  • 75
1
vote
1 answer

utop installation using opam fails in fedora 25

I have an error installing utop in fedora 25 when I run "opam install utop". The first time I ran the command some packages were installed, but not all. I ran the same command again and got the error message below. Any suggestion? The following…
user2926204
  • 111
  • 8
1
vote
0 answers

utop - command not found

Suddenly when trying to use utop on my macbook, I get the error in the title. I've tried reinstalling with opam and reinstalling with homebrew but I've had no success. I haven't changed anything, this just randomly started happening. Has anyone had…
PP Laru
  • 91
  • 1
  • 12
1
vote
0 answers

utop no longer supporting camlp4?

I wanted to use a package which has some camlp4 extensions in utop, but I get: utop # #camlp4o;; utop was built without camlp4 support. This is with utop version 2.0.1 and OCaml 4.05.0. I installed utop with opam. Is there a way to rebuild utop…
aneccodeal
  • 8,531
  • 7
  • 45
  • 74
1
vote
1 answer

Use utop with local ocaml build?

I've compiled a custom version of ocaml 4.04.0 (which someone else wrote). I can run it and interact with it using rlwrap and ledit, but I would rather run it with utop. (I don't need autocompletion; command editing is nicer in utop than in rlwrap…
Mars
  • 8,689
  • 2
  • 42
  • 70
1
vote
0 answers

Why does utop flash?

In utop (on osx), the black border around the yellow welcome message, and the red line between each command flash. I thought it might be telling me to update something, but I can't find any message. Is there a way to turn this off? Or is it trying…
Alex028502
  • 3,486
  • 2
  • 23
  • 50
1
vote
1 answer

OCaml unable to load "extLib.cma" from toplevel

When I attempt to load the file extLib.cma in utop, OCaml's top level, I get the following error: Cannot find file extLib.cma However, if I try to install it using opam I get the following note: Package extlib is already installed. What am I doing…
David Farthing
  • 237
  • 2
  • 13
1
vote
1 answer

replace camlp4 with camlp5 in utop

I'm working with OCaml code that needs camlp5; however, the toplevel (I'm using utop) automatically loads the newer, incompatible camlp4. These are the startup messages: Findlib has been successfully loaded. Additional directives: #require…
jules
  • 1,897
  • 2
  • 16
  • 19
1
vote
1 answer

_no_unused_value_warning_ `with sexp` in utop

I added require "sexplib.syntax";; and core etc in utop. If I type module type Printer = sig type t with sexp end in utop, it says module type Printer = sig type t val t_of_sexp : Sexp.t -> t val sexp_of_t : t -> Sexp.t end ok, this is no…
Jackson Tale
  • 25,428
  • 34
  • 149
  • 271
1
vote
2 answers

"Unbound type constructor _no_unused_value_warning" (only when #use ing file)

Consider this very basic module definition: module type My_test = sig type config with sexp end;; When I directly enter this on the utop prompt, everything works fine: utop # module type My_test = sig type config with sexp end;; module type…
Frank Schmitt
  • 30,195
  • 12
  • 73
  • 107
0
votes
2 answers

Base won't load in utop

So basically I am trying to follow these instructions https://dev.realworldocaml.org/install.html I followed them literally. I have a working utop. I have a working VS Code environment. I can run code and everything. We know the Base package is more…
v_head
  • 759
  • 4
  • 13