If I want to add all the elements of a list of tuples, I get an error with the following
let rec addTupLst (xs: 'a * 'a list) =
match xs with
| (a, b) :: rst -> a + b + (addTupLst rst)
| _ -> 0
addTupLst [(1, 2)]
I get a warning
error FS0001: this expression is expected to be of type 'a *' list
but there is type 'b list here
Is it impossible to match the pattern in the tuple list this way, or is there another error?
source
share