You need to use it ofwhen declaring a type, so you can just build the values ββusing the constructor bar2, for example:
bar2 a
Your second function should work if you change it to:
let (|MatchFoo2|_|) aString =
match aString with
| "abcd" -> Some (bar2 a)
| _ -> None
source
share