I'd like to convert tuple of two elements having the same type to a list. Code looks simple as this:
let toList (tuple: 'a * 'a): 'a list =
match tuple with
| (_ as fst, _ as snd) -> [fst; snd]
But somehow type of snd is 'a * 'a, so it seems like instead of binding second element of tuple to a variable the whole tuple is bound instead. Is it a bug in compiler or am I missing sth?
Actual code is more complicated, so the idea is not to rewrite the piece provided, but to understand what is wrong with the as usage here. I'd expect that as should go after the tuple to bound it as a whole, like this | (_ as fst, _ as snd) as tuple