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 = MkWindow {
win
:: GLUT.Window, -- the real window
events ::
Events -- the event stream
}
And in Hugs Graphics Library the "Window" is defined as:
data Window = MkWindow {
wnd ::
WND, -- the real
window
events :: Events, --
the event stream
graphic :: IORef (Draw ()) -- the
current graphic
}
Thanks,
Andre