Consider the following:
$ ocaml
OCaml version 4.13.1
# open List;;
# let rec split_toc_title a = function
| '\\'::'n'::r -> rev a :: split_toc_title a r
| x::xs -> split_toc_title (x::a) xs
| [] -> [rev a];;
val split_toc_title : char List.t -> char List.t -> char list List.t = <fun>
The list type is printed both as list
, and as the alias List.t
, in particular in char list List.t
it is surprising.
My intuition here is that List.t
comes from the use of ::
(due to the alias) and list
from the use of rev
(due to list.mli
using list
in the type of rev
).
Is this expected, or should we expect OCaml to always use the same format when one type is an alias of another (i.e char List.t List.t
or char list list
)?