Skip to content

Instantly share code, notes, and snippets.

@kennetpostigo
Last active June 26, 2018 15:32
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 kennetpostigo/9fdfe048a0638f1ca943ab4a882a6c4e to your computer and use it in GitHub Desktop.
Save kennetpostigo/9fdfe048a0638f1ca943ab4a882a6c4e to your computer and use it in GitHub Desktop.
Reason BST Blog Post variants
/* pet is called a type constructor. Dog, Cat, and
Hamster are called value constructors or tags*/
type pet =
| Dog
| Cat
| Hamster;
/* myPet is of type pet */
let myPet = Dog;
/* Variants may also hold data */
type pets =
| Dog(string)
| Cat(string)
| Hamster(string);
let myPet = Dog("Buddy");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment