Class Question

Matthew Donadio m.p.donadio@ieee.org
Thu, 23 Jan 2003 00:40:02 -0500


Hi all,

I have yet another question.  I think I have too much time on my hands.

I have two functions:

> rf     :: (RealFloat a, Integral b) => [a] -> b -> Complex a
> rf x k = ...

> cf     :: (RealFloat a, Integral b) => [Complex a] -> b -> Complex a
> cf x k = ...

I would like to add these to the class system so I can create an
overloaded version, f.

>From my understanding of the Report, the following should work, but I
get an error, which I really don't understand.

> class (Fractional a) => Floating a where
>     f :: (Integral b) => [a] -> b -> a

> instance (RealFloat a) => Floating a where
>     f x k = rf x k

> instance (RealFloat a) => Floating (Complex a) where
>     f x k = cf x k

hugs98 spits out

	ERROR "f.lhs":59 - Syntax error in instance head (constructor
expected)  

where line 59 is the first instance declaration.  Can anyone give me
some guidance, or hints, here?

Thanks a million.

-- 
Matthew Donadio (m.p.donadio@ieee.org)