Skip to content

Instantly share code, notes, and snippets.

@ganwell

ganwell/either.ml Secret

Last active Dec 16, 2018
Embed
What would you like to do?
(* Teams and players *)
type team0 = Player0 | Player2
type team1 = Player1 | Player3
(* Tests *)
let a = Player0
let is_player0 a = a == Player0
let is_first_player_of_team a = a == Player0 || a == Player1
(* Error: This variant expression is expected to have type team0
* The constructor Player1 does not belong to type team0
* Hint: Did you mean Player2 or Player0? *)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.