Created
October 11, 2018 10:42
-
-
Save isaacabraham/0b28ded9a75bcf4f20db11aedec219eb to your computer and use it in GitHub Desktop.
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 Person = { IsClever : bool } | |
let p = { IsClever = true } | |
/// Warning - missed "false" | |
let example1 = | |
match p with | |
| { IsClever = true } -> "Yes, this person is clever" | |
/// No warning - all cases matched | |
let example2 = | |
match p with | |
| { IsClever = true } -> "Yes, this person is clever" | |
| { IsClever = false } -> "Fully matched!" | |
/// Warning - even though all cases are "theoretically" matched | |
let example3 = | |
let number = 10 | |
match p with | |
| { IsClever = true } -> "Yes, this person is clever" | |
| { IsClever = false } when number > 10 -> "Clever when number is more than 10" | |
| { IsClever = false } when number <= 10 -> "Clever when number is not more than 10" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment