Guest User

Untitled

a guest
Dec 24th, 2017
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
OCaml 0.34 KB | None | 0 0
  1. type foo = [ `A | `B ]
  2. type _ bar =
  3.   | A : [> `A] bar
  4.   | B : [> `B] bar
  5.  
  6. (* This function's type is inferred to be [ `A | `B ] bar -> string
  7.    Is it possible for it to be            [< `A | `B ] bar -> string ? *)
  8. let to_string (t : [< `A | `B] bar) =
  9.   match (t : [< `A | `B] bar :> [`A | `B] bar) with
  10.   | A -> "A"
  11.   | B -> "B"
Advertisement
Add Comment
Please, Sign In to add comment