Fwd: [Haskell-cafe] Defining methods generically for a class

Jeff Heard jefferson.r.heard at gmail.com
Thu Jan 8 12:27:54 EST 2009


---------- Forwarded message ----------
From: Jeff Heard <jefferson.r.heard at gmail.com>
Date: Thu, Jan 8, 2009 at 12:26 PM
Subject: Re: [Haskell-cafe] Defining methods generically for a class
To: Cristiano Paris <frodo at theshire.org>


Not really...  I'm not testing if each of the items a are equal, but
rather that in the context of them being a Region, they are equal.As
long "dim" (which is in the class) can be defined, then equality is
defined over all types Region.

On Thu, Jan 8, 2009 at 12:16 PM, Cristiano Paris <frodo at theshire.org> wrote:
> On Thu, Jan 8, 2009 at 6:04 PM, Jeff Heard <jefferson.r.heard at gmail.com> wrote:
>> ...
>> How do I declare all Regions to be Eqs without putting it in the class
>> body (since I define a function over all Regions that is independent
>> of datatype that is an instance of Region)?
>
> Would this be a solution?
>
> class Eq a => Region a where
>  ...
>
> Cristiano
>


More information about the Haskell-Cafe mailing list