Skip to content

Instantly share code, notes, and snippets.

@ganwell
Last active December 16, 2018 19:23
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save ganwell/c8f1d993b8a473d5705047e9eafe5e94 to your computer and use it in GitHub Desktop.
(* 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