Skip to content

Instantly share code, notes, and snippets.

@soutaro
Last active March 20, 2017 09:32
Show Gist options
  • Save soutaro/9c163f017bb3224d819fc80d3aca1092 to your computer and use it in GitHub Desktop.
Save soutaro/9c163f017bb3224d819fc80d3aca1092 to your computer and use it in GitHub Desktop.
class ['a] rbarray = object method map : 'b . ('a -> 'b) -> 'b rbarray = Obj.magic () end;;
(* Error: The universal type variable 'b cannot be generalized:
it escapes its scope. *)
@garrigue
Copy link

Recursive types in OCaml must be regular, i.e. You cannot change the type parameter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment