hiding import, tuple instances

Cagdas Ozgenc co19@cornell.edu
Fri, 31 Aug 2001 18:53:11 +0300


This is a multi-part message in MIME format.

------=_NextPart_000_0009_01C1324E.2EDC6C40
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi,

1) How can I hide an instance of a class imported from prelude? For =
example I would like to redefine

instance (Ord a, Ord b) =3D> Ord (a,b) where
 (<=3D) (x,y) (z,w)
  | x < z =3D True
  | x =3D=3D z =3D if y <=3D w then True else False
  | otherwise =3D False

for educational purposes.

2) I could not find an entry for this instance in Prelude instead I =
found

instance Ord () where

compare () () =3D EQ


Is this suppose to mean "for all tuples"?

How do I define functions that work on all tuples?

Thanks for taking time


------=_NextPart_000_0009_01C1324E.2EDC6C40
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>1) How can I hide an instance of a =
class imported=20
from prelude? For example I would like to redefine</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>instance (Ord a, Ord b) =3D&gt; Ord =
(a,b)=20
where<BR>&nbsp;(&lt;=3D) (x,y) (z,w)<BR>&nbsp; | x &lt; z&nbsp;=3D =
True<BR>&nbsp; |=20
x =3D=3D z&nbsp;=3D if y &lt;=3D w then True else False<BR>&nbsp; | =
otherwise&nbsp;=3D=20
False</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>for educational purposes.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>2) I could not find an entry for this =
instance in=20
Prelude instead I found</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><FONT size=3D2>
<P>instance Ord () where</P>
<P>compare () () =3D EQ</P></FONT></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Is this suppose to mean "for all=20
tuples"?</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>How do I define functions that work on =
all=20
tuples?</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks for taking time</FONT></DIV>
<DIV>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_0009_01C1324E.2EDC6C40--