what's the difference?

Cagdas Ozgenc co19@cornell.edu
Thu, 11 Jul 2002 13:44:25 +0300


This is a multi-part message in MIME format.

------=_NextPart_000_000E_01C228E1.121AE3E0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Greetings.

What is the difference between the following two scenarios:

1)

class Eq a where=20
    (=3D=3D) :: a -> a -> Bool

class Eq a =3D> Ord a where
    ( < ) :: a -> a -> Bool

2)

class Eq a where
    (=3D=3D) :: a -> a -> Bool

class Ord a where
    (eq),( < ) :: a -> a -> Bool

instance Ord a =3D> Eq a where
     (=3D=3D) =3D eq

eq is just a rename for =3D=3D to avoid the nameclash

The second scenario resembles Russell's Paradox. Typeclass of a =
typeclass. Anyhow we are loosing orthogonality here.

Thanks

------=_NextPart_000_000E_01C228E1.121AE3E0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.3504.2500" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Greetings.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>What is the difference between the =
following two=20
scenarios:</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>1)</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>class Eq a where </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; (=3D=3D) :: a -&gt; =
a -&gt;=20
Bool</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>class Eq a =3D&gt; Ord a =
where</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; ( &lt; ) :: a -&gt; =
a -&gt;=20
Bool</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>2)</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>class Eq a where</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; (=3D=3D) :: a -&gt; =
a -&gt;=20
Bool</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>class Ord a where</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; (eq),( &lt; ) :: a =
-&gt; a -&gt;=20
Bool</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>instance Ord a =3D&gt; Eq a =
where</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp;&nbsp; (=3D=3D) =3D =
eq</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>eq is just a rename for =3D=3D to avoid =
the=20
nameclash</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>The second scenario resembles Russell's =
Paradox.=20
Typeclass of a typeclass. Anyhow we are loosing orthogonality =
here.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks</FONT></DIV></BODY></HTML>

------=_NextPart_000_000E_01C228E1.121AE3E0--