The packages are installed correctly.
opam install core
[NOTE] Package core is already installed (current version is v0.14.1)
opam install base
[NOTE] Package base is already installed (current version is v0.14.1).
My .ocamlinit file has
(* ## added by OPAM user-setup for ocamltop / base ## 3ec62baf6f9c219ae06d9814069da862 ## you can edit, but keep this line *)
(* ## end of OPAM user-setup addition for ocamltop / base ## keep this line *)
#use "topfind";;
#thread;;
#camlp4o;;
#require "core.top";;
#require "core.syntax";;
The really strange thing is - when I startup ocaml's top level using the ocaml
command
it loads everything up correctly and commands like open Core;;
open Base;;
work. But they don't work with utop. I get Error: Unbound module Core
. Similarly merlin
in VS-code gives me red-squiggly lines if I write open Core
.
Can someone help me understand what's happening? I can give you more details if they are helpful. I've already looked at all the similar questions that have been asked and none have helped me solve this.
Edit: If it helps, this is the result of opam switch
❯ opam switch
# switch compiler description
-> 4.12.0 ocaml-base-compiler.4.12.0 4.12.0
default ocaml-base-compiler.4.12.0 default
utop
was not installed with opam
but with brew
so it couldn't find the libraries.
Remember to always clean all OCaml related things before installing everything with opam
or it may break things.