Last active
August 29, 2015 14:07
-
-
Save artur-s/ee7b6815f3b71f3793e6 to your computer and use it in GitHub Desktop.
Option helper functions
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
| module Option | |
| let Else second = function | |
| | Some _ as first -> first | |
| | None -> second | |
| let ofNullable = function | |
| | null -> None | |
| | i -> Some i | |
| let filter p = function | |
| | Some v -> if p v then Some v else None | |
| | _ -> None |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment