I wanna do:
let Some(x) = bar in ...
but I can't do this unless I do
let Some(x) as idontcare = bar in ...
is there a better way to say "I don't care about the whole pattern, just match the inside"
(I would use _
but that doesn't parse so I am using __
instead)
Yes I know this is partial, I just am doing a quick script.
Edit: Also this is just an example with a builtin sum type, so Option.get
is not generic; plus I want this to be inline like the Haskell let-bindings.
let Some(x) = bar
defines a new function Some
, shadowing the existing constructor. Instead, you want:
let (Some(x)) = bar
You could use a match
:
match bar with | Some(x) -> ...
if you're trying to match an option specifically you could use Option.get
:
bar |> Option.get |> ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With