module MapHelpers (Ord : Map.OrderedType) = struct include Map.Make (Ord) let add_all ab = fold add ab end
works, but seemingly equivalent
module MapHelpers (Ord : Map.OrderedType) = struct include Map.Make (Ord) let add_all = fold add end
cannot compile with
File "Foo.ml", line 2, characters 18-104: Error: The type of this module, functor (Ord : Map.OrderedType) -> sig ... val add_all : '_a t -> '_a t -> '_a t end, contains type variables that cannot be generalized Command exited with code 2.
and adding explicit type annotation
: 'a . 'at -> 'at -> 'at
causes compilation to fail with
Error: This definition has type 'at -> 'at -> 'at which is less general than 'a0. 'a0 t -> 'a0 t -> 'a0 t
Why does adding explicit ab forms change the way you enter these two modules?
ocaml monomorphism
Mike samuel
source share