classes

Cagdas Ozgenc co19@cornell.edu
Fri, 31 Aug 2001 12:56:32 +0300


This is a multi-part message in MIME format.

------=_NextPart_000_0006_01C1321C.5BB47230
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi,

I am a newbie, so I might be making nonsense.

In the following definiton:

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

Why do we conlude that both of the "a" refer to the same type? =
Apparently using different types that both belonging to class Eq results =
in an error. For example

65 =3D=3D 'a'

It doesn't make much sense at first, however, how do you go by =
implementing multiple polymorphism?

Secondly, why does Haskell distinguish between a Type and a Class? There =
seems to be no benefit of such approach.

Thirdly, is it possible to define meta-classes in Haskell?

Thanks

------=_NextPart_000_0006_01C1321C.5BB47230
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.3103.1000" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi,</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I am a newbie, so I might be making=20
nonsense.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>In the following =
definiton:</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>Why do we conlude that both of the "a" =
refer to the=20
same type? Apparently using different types that both belonging to class =
Eq=20
results in an error. For example</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>65 =3D=3D 'a'</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>It doesn't make much sense at first, =
however, how=20
do you go by implementing multiple polymorphism?</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Secondly, why does Haskell distinguish =
between a=20
Type and a Class? There seems to be no benefit of such =
approach.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thirdly, is it possible to define =
meta-classes in=20
Haskell?</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks</FONT></DIV></BODY></HTML>

------=_NextPart_000_0006_01C1321C.5BB47230--