Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- type _ op = Noop
- and _ t =
- | Null : int t
- | Op : 'e t * 'e op -> 'a t
- (* when -principal is enabled, this function typechecks... *)
- let g : type a . a t -> unit =
- fun t ->
- let op_idx : int op * int =
- match t with
- | Null -> Noop, 1
- | Op (Null, op) -> op, 2
- | _ -> assert false in
- let op, idx = op_idx in
- ()
- (* ...and this is not *)
- let f : type a . a t -> unit =
- fun t ->
- let (op, idx) : int op * int =
- match t with
- | Null -> Noop, 1
- | Op (Null, op) -> op, 2
- | _ -> assert false in
- ()
Advertisement
Add Comment
Please, Sign In to add comment