Re: Help need "Cannot use type synonym in instance head"

14 Apr
2002
14 Apr
'02
12:31 a.m.
At 2002-04-13 21:22, Benny wrote:
type Poly = [Float]
addPoly::Poly->Poly->Poly addPoly x y = zipWith (+) x y
instance (Float a) => Num (Poly a) where (+) = addPoly
I got the error message "Cannot use type synonym in instance head" when I was trying to compile the codes above. Can anyone tell me why and how to solve it?
There are at least two errors here. Firstly the context of your instance "(Float a) =>" is wrong. "Float" is not a class. Secondly, "(Poly a)" is meaningless, since Poly is a type and does not take any parameter. -- Ashley Yakeley, Seattle WA
8437
Age (days ago)
8437
Last active (days ago)
0 comments
1 participants
participants (1)
-
Ashley Yakeley