Last active
June 26, 2018 15:32
Reason BST Blog Post variants
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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