-
-
Save Wilfred/f22723e664d4bee69b3a4eba7a2aea0e to your computer and use it in GitHub Desktop.
matching on constructor of two arguments
This file contains 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
type name = | |
Nickname of string | |
| FullName of string * string | |
let match_on_name n = | |
match n with | |
Nickname s -> 1, Nickname s | |
| FullName (x, y) -> 2, FullName (x, y) | |
let match_on_name2 n = | |
match n with | |
Nickname s -> 1, Nickname s | |
| FullName s -> 2, FullName s (* constructor requires two arguments *) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment