[Haskell-cafe] Confused by instances

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Mon Apr 28 16:50:53 EDT 2008


On Apr 28, 2008, at 16:22 , Fraser Wilson wrote:

> > instance (Num a) => ValueClass a where
> >     fromValue (Value n) = fromInteger n
>
> What I'm really confused by is the response to instance (Num a) =>  
> ValueClass a -- what I am trying to say is "if a is an instance of  
> Num, then can be an instance of ValueClass too, and here's how".

The format is instance [context =>] classname instance.
Your classname is ValueClass.
Your instance is a.  a is not of the form (T a1 ... an).

(How to fix it?  Not sure, and am trying to get myself out of here  
and on the road :)

-- 
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH




More information about the Haskell-Cafe mailing list