How does one check the ocaml version one is using?

Seems this question is not as simple as I thought. Probably because there is a toplevel and a compiler. I can’t seem to have the toplevel to be the version I want but I’ve been successfully able to switch between compiler version.

Check the session where I try switching version but the toplevel doesn’t change but the compiler does.

(base) ❯ opam switch list
#  switch   compiler                    description
→  4.05.0   ocaml-base-compiler.4.05.0  4.05.0
   4.06.0   ocaml-base-compiler.4.06.0  4.06.0
   4.07.0   ocaml-base-compiler.4.07.0  4.07.0
   default  ocaml-system.4.07.0         default
(base) ❯ opam switch 4.06.0
(base) ❯ ocaml --version
The OCaml toplevel, version 4.07.0
(base) ❯ opam switch list
#  switch   compiler                    description
   4.05.0   ocaml-base-compiler.4.05.0  4.05.0
→  4.06.0   ocaml-base-compiler.4.06.0  4.06.0
   4.07.0   ocaml-base-compiler.4.07.0  4.07.0
   default  ocaml-system.4.07.0         default

So my question here is what are all the commands to check all ocaml versions running, toplevel, compiler etc? (idk if there are more things I should be aware of hence the etc).


related questions:

# to synchronize your environment with opam
# (assuming your are using the bash shell)
eval `opam env --shell=bash`
# interpreter version
ocaml --version
The OCaml toplevel, version 4.07.1
# compiler version
ocamlc --version
4.07.1