-
Notifications
You must be signed in to change notification settings - Fork 783
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Struct representations for active patterns limitations #12389
Comments
The first one is fsharp/fslang-suggestions#848 while the second one can already be done: let f2 ((|AP|_|): _ -> _ voption) =
match 1 with AP 1 -> 1 | _ -> 2 |
It's great that let f1() =
match
(fun x ->
if x > 100 then
ValueSome 1
else
ValueNone
) with
| ``|AP|_|`` ->
match 1 with AP 1 -> 1 | _ -> 2 yet a simple let binding would give an error. |
I'll close this per @Happypig375's comment #12389 (comment) |
let f1() =
fun x ->
if x > 100 then
ValueSome 1
else
ValueNone
|> fun (|AP|_|) ->
match 1 with AP 1 -> 1 | _ -> 2 |
@dsyme Does that mean fsharp/fslang-suggestions#848 is approved? |
Ah my mistake, I thought the link was referring to the idea of simply inferring structness from return type here fsharp/fslang-suggestions#1041 (comment) |
I would expect to be able to simply switch an existing active pattern to use structs but it seems limited. Any reason for restricting use to top level active patterns? Would be nice to be able to do the following:
or
The text was updated successfully, but these errors were encountered: