Last active
January 3, 2019 14:30
-
-
Save jhewlett/e1775dffb6552aff28883936536e42c1 to your computer and use it in GitHub Desktop.
Nested match
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
let findThing id = | |
match findThingA id with | |
| None -> None | |
| Some thingA -> | |
match findThingB id with | |
| None -> None | |
| Some thingB -> | |
combine thingA thingB |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you don't like this and you prefer the C#/Java-style early returns, you can write:
This is not a problem as the compiler will yell what to fix if you change the return type of your function in one place.