public
Authored by
Lucas Baudin

gadt wrapped

gadt.ml 360 bytes
type _ data =
| TInt : int -> int data
| TBool: bool -> bool data

type edata = { node: 's. 's data }

type file = edata list

let do_stuff : type s.  s data -> unit = fun s ->
  match s with
  | TInt a -> print_int a; print_endline "";
  | TBool b -> if b then print_endline "hello world"

let match_f (f: file) =
  List.iter (fun e ->
    do_stuff e.node ) f
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment