7 Sep
2006
7 Sep
'06
3:51 p.m.
Peter Arrenbrecht
ERROR file:.\cube.hs:11 - Type error in explicitly typed binding *** Term : [(i,v) : ps] *** Type : [[(a,b)]] *** Does not match : [(Int,Double)]
[10] test :: [(Int, Double)] -> Int [11] test [(i,v):ps] = i
The error message does contain the answer. Your pattern [(i,v):ps] represents a singleton list containing a list of pairs. That is a list of lists. What the explicit type signature reveals to be your intention was a single-level list of pairs. To fix, use round parens around the pattern, not square brackets: ((i,v):ps) Regards, Malcolm