I'm writting a recursive function that use specific formulas to calculate 2 lists. But I will simplify the function so you can understand the problem I'm having because the point here is to detect [] of the list.
So I've the following code:
listSum::([Integer],[Integer])->Double
listSum ((x:xs),(y:ys))
| ((x:xs),(y:ys))==(x:[],y:[])=0.0
| otherwise = (((fromIntegral x)::Double)+((fromIntegral y)::Double)) + listSum ((xs),(ys))
Output I'm having right now
listSum([1,2],[1,2])
2.0
listSum([1],[1])
0.0
listSum([],[])
*** Exception: file.hs: .....: Non-exhaustive patterns in function ListSum
And the output I wish to have
listSum([1,2],[1,2])
6.0
listSum([1],[1])
2.0
listSum([],[])
0.0
What did I miss? Or did I write too much?