Skip to content

Instantly share code, notes, and snippets.

@Drup
Forked from gsg/gist:e8abe67399bdbcad37c4
Created July 29, 2014 14:31
Show Gist options
  • Save Drup/8f43b945f96118156706 to your computer and use it in GitHub Desktop.
Save Drup/8f43b945f96118156706 to your computer and use it in GitHub Desktop.
type one = [ `One ]
type two = [ `Two ]
type +_ t = OneA | OneB | TwoA | TwoB
let oneA : [> one ] t = OneA
let oneB : [> one ] t = OneB
let twoA : [> two ] t = TwoA
let twoB : [> two ] t = TwoB
let over_ones : [< one] t -> string = function
| OneA -> "onea"
| OneB -> "oneb"
| _ -> assert false
let over_twos : [< two ] t -> string = function
| TwoA -> "onea"
| TwoB -> "oneb"
| _ -> assert false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment