Is there any way to use a discriminated union of the following form with active pattern matching? I haven't been able to find any examples.
This is what I'm trying to do:
type c = a | b
type foo =
  | bar1
  | bar2 of c
//allowed
let (|MatchFoo1|_|) aString =
  match aString with
  | "abcd" -> Some bar1
  | _ -> None
//not allowed
let (|MatchFoo2|_|) aString =
  match aString with
  | "abcd" -> Some (bar2 of a)
  | _ -> None
Why can "Some" not be used in the second way? Is there another way to achieve the same thing?
 
    