Duvidas
Andre W B Furtado
aw@free.elogica.com.br
Wed, 28 Mar 2001 02:35:11 -0300
This is a multi-part message in MIME format.
------=_NextPart_000_0005_01C0B72F.B655DC00
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
In Hugs Graphics Library, many procedures call the function getEvent =
with a Window as the parameter. But getEvent is defined as below:
getEvent :: Events -> IO Event
How does this work? I've tryied to do something similar and got the =
following error message (in GHC):
Couldn't match `Events' against `Window'
Expected type: Events
Inferred type: Window
In the first argument of `getEvent', namely `w'
In a do statement: e <- getEvent w
In time: my "Window" is defined as following
data Window =3D MkWindow {=20
win :: GLUT.Window, -- the real window
events :: Events -- the event stream
}
And in Hugs Graphics Library the "Window" is defined as:
data Window =3D MkWindow {
wnd :: WND, -- the real window
events :: Events, -- the event stream
graphic :: IORef (Draw ()) -- the current graphic
}
Thanks,
Andre
------=_NextPart_000_0005_01C0B72F.B655DC00
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.2614.3500" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>
<DIV>In Hugs Graphics Library, many procedures call =
the function=20
getEvent with a Window as the parameter. But getEvent is =
defined=20
as below:</DIV>
<DIV> </DIV>
<DIV>getEvent :: Events -> IO Event</DIV>
<DIV> </DIV>
<DIV>How does this work? I've tryied to do something similar and =
got the=20
following error message (in GHC):</DIV>
<DIV> </DIV>
<DIV> Couldn't match `Events' against=20
`Window'<BR> Expected type:=20
Events<BR> Inferred type:=20
Window<BR> In the first argument of `getEvent', namely =
`w'<BR> In a do statement: e <- getEvent =
w<BR></DIV>
<DIV>In time: my "Window" is defined as following</DIV>
<DIV> </DIV>
<DIV>data Window =3D MkWindow { <BR> =
win =20
:: GLUT.Window, -- the real window<BR> =
events ::=20
Events -- the event stream<BR> }</DIV>
<DIV> </DIV>
<DIV>And in Hugs Graphics Library the "Window" is defined as:</DIV>
<DIV> </DIV>
<DIV>data Window =3D MkWindow {</DIV>
<DIV> wnd ::=20
WND, -- the real=20
window<BR> events :: =
Events, --=20
the event stream<BR> graphic :: IORef (Draw ()) =
-- the=20
current graphic<BR> }<BR></DIV>
<DIV>Thanks,</DIV>
<DIV>Andre</DIV></FONT></DIV></BODY></HTML>
------=_NextPart_000_0005_01C0B72F.B655DC00--