Skip to content

Instantly share code, notes, and snippets.

@Pitometsu
Created August 21, 2019 17:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pitometsu/6a346dd626f6eb62576d16b4b06e7507 to your computer and use it in GitHub Desktop.
Save Pitometsu/6a346dd626f6eb62576d16b4b06e7507 to your computer and use it in GitHub Desktop.
first-class modules type limitation
utop # let (module M) = (module Caml.Map.Make(Int64) : Caml.Map.S) in let to_ : unit -> _ M.t = fun () -> failwith "und" in to_;;
Error: This expression has type unit -> 'a M.t
but an expression was expected of type 'b
The type constructor M.t would escape its scope
utop # let module M = Caml.Map.Make(Int64) in let to_ : unit -> _ M.t = fun () -> failwith "und" in to_;;
- : unit -> 'a Map.Make(Core_kernel__Int64).t = <fun>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment