Last active
August 29, 2015 13:59
-
-
Save qxjit/10497069 to your computer and use it in GitHub Desktop.
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
type A = | |
| A of int | |
| B of string | |
> List.choose (|A|_|) [ A 3; B "foo"];; | |
List.choose (|A|_|) [ A 3; B "foo"];; | |
-------------^^^^^ | |
/vagrant/stdin(6,14): error FS0039: The value or constructor '|A|_|' is not defined | |
let (|IsA|_|) x = match x with | A i -> Some i | _ -> None;; | |
> List.choose (|IsA|_|) [ A 3; B "foo"];; | |
val it : int list = [3] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment