ocaml

Please explain this OCaml type definition


Record definition:

type t = {name: string}

Variant definition :

type thing = Thing1 | Thing2;

Can anyone example what the following snippet defines?

type ('a, 'b) t =
   Blah : ((('a, 'b) Tea_result.t -> unit) -> unit) -> ('a, 'b) t

More Generally, this structure:

type t = Blah : xxx

Any insight would be appreciated.


Solution

  • This is Generalized Algebraic Data Type - have a look at https://ocaml.org/manual/5.3/gadts-tutorial.html