Is it possible in F# to pattern match directly against a let binding?
For example, this compiles without any warnings:
let value =
match
You can only use literals if you want to match against a particular value in a pattern matching case. An identifier means binding -- i.e. the actual value in this pattern matching case will be bound to the identifier that will be visible in the scope of this case.
As @DanielFabian has shown, you can define your own literals and give them names.
If the value you need to match against isn't known at compile time, you can use guards like so:
match arg with
| x when x = key1 -> "value1"
| x when x = key2 -> "value2"
| _ -> // etc
See the MSDN article on pattern matching for more details.