[Haskell-cafe] Re: Decoupling type classes (e.g. Applicative)?

Brandon S Allbery KF8NH allbery at ece.cmu.edu
Mon Nov 8 23:25:20 EST 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 11/3/10 21:30 , Maciej Piechotka wrote:
> On Tue, 2010-11-02 at 21:57 -0400, Brandon S Allbery KF8NH wrote:
>> On 10/29/10 09:35 , Dominique Devriese wrote:
>>> * Only introduce a dependency from type class A to type class B if all
>>>   functions in type class B can be implemented in terms of the
>>>   functions in type class A or if type class A is empty.
>>
>> Er?  Eq a => Ord a makes perfect sense in context but violates this law.
> 
> x == y = case x `compare` y of EQ -> True; _ -> False

So, gratuitous duplication.  Leading to the potential for the lovely case
where Eq does one thing and `compare` does something else.  This is an
improvement?

- -- 
brandon s. allbery     [linux,solaris,freebsd,perl]      allbery at kf8nh.com
system administrator  [openafs,heimdal,too many hats]  allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university      KF8NH
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.10 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkzYzTAACgkQIn7hlCsL25U91wCgz1kGXIyrlOqq69qnAyK4F1jm
De0AoM8mwq39+qFQRRZSsf3Qu8dSLoQr
=IMhV
-----END PGP SIGNATURE-----


More information about the Haskell-Cafe mailing list