Perfect! Problem solved and now I understand about "kinds" of types.
instance Rect (PRect a) a where ...
works if "Num a" is added to it, like:
instance Num a => Rect (PRect a) a where ...
(GHC has pretty informative error messages)
Thank you for great answers!
/johan
_
Am Donnerstag, 30. Juni 2005 14:07 schrieb Johan Holmquist:
> [...]
> Anyone:
>
> However, I haven't been able to make PRect an instance of this class (with
> extensions).
If I understand your problem correctly, you may use the new Rect class (the
one which is declared as class Num b => Rect a b
Johan Holmquist <[EMAIL PROTECTED]> writes:
> > class Num b => Rect a b | a -> b where
> > instance Rect IRect Int where
>
> However, I haven't been able to make PRect an instance of this class (with
> extensions). I might not have grasped this yet, but I came to think; if the
> old class decla
> This type declaration for 'm' probably doesn't mean what you think it
> does. I think what you want is "m takes an item of type 'a' and returns
> an item of a particular type in the Num class, but I'm not going to tell
> you which one", but what this declaration really means "m takes an item
> o
Hi,
How do you instantiate from classes with method type constraints, such as this
one:
class C a where
m :: (Num b) => a -> b
This type declaration for 'm' probably doesn't mean what you think it
does. I think what you want is "m takes an item of type 'a' and returns
an item of a part
Hi,
How do you instantiate from classes with method type constraints, such as this
one:
class C a where
m :: (Num b) => a -> b
??
I have been trying for some time now but everything I have tried fails.
In particular, what I want to do is something like this:
class Rect a where
wid