Skip to content

Instantly share code, notes, and snippets.

@misterspeedy
Created October 8, 2013 18:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save misterspeedy/6889717 to your computer and use it in GitHub Desktop.
Save misterspeedy/6889717 to your computer and use it in GitHub Desktop.
DU to represent a suit
type Suit =
| Club | Diamond | Heart | Spade
static member FromChar c =
match c with
| '♣' -> Club | '♦' -> Diamond | '♥' -> Heart | '♠' -> Spade
| _ -> raise (ArgumentException(sprintf "Invalid suit character: %c" c))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment