Search code examples
moduleocamlutop

Why does Utop treat this Ocaml code differently


module D = struct type t = float list end
module DF(D) = struct type t = D.t end

gets a syntax error in utop

However,

module D = struct type t = float list end;;
module DF(D) = struct type t = D.t end

Does not


Solution

  • Utop ignores everything on the right of ;; since ;; signals the end of a toplevel phrase.