<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#000000" text="#ffffff">
On 30/06/11 23:53, Arlen Cuss wrote:<br>
[snip]<br>
<br>
<blockquote cite="mid:4E0CFE7B.9070608@sairyx.org" type="cite">
<blockquote type="cite">
<pre wrap="">and modify the assignment in main to this:
keyboardMouseCallback $= Just (myKeyMouse gameState)
</pre>
</blockquote>
</blockquote>
I think that part of my confusion was, on reflection, caused by the
fact that coming from a procedural background, the syntax of "Just
(myKeyMouse gameState) still reads as "function call arguments", so
if I may be permitted to expand on that to see if I now understand
Haskell a little more ...<br>
<br>
The form: "Just (myKeyMouse gameState)" looks like its calling the
Just function with two parameters as the () is also used to define a
tuple. So is (myKeyMouse gameState) a tuple of one, the result of
calling that function with that parameter or is just a way of
ensuring that the function is performed before it is passed to Just
as the one and only parameter?<br>
<br>
I know the correct answer but I did sometimes get confused over
when is a tuple "()" not a tuple, especially in things like this:<br>
<br>
foo (x:xs) = ...<br>
<br>
I *know* it is pattern matching using ':' and that ':' takes a thing
and a list of things and returns a list of same things but old
habits.. DOH!<br>
<br>
Back to the chase. <br>
<br>
If I had rewritten the Just called like this I think it would have
been clearer about what was happening:<br>
<br>
Just $ myKeyMouse gameState<br>
<br>
as that quite clearly says, call myKeyMouseFirst and then hand the
result to Just. From that point, Arlens great description of how it
trundles through the type system, resulting in a partially evaluated
function that has the *same* type as the expected one for the
keyboardMouseCallback is really making it clearer for me now. That
was a loud Eureka moment in my kitchen over breakfast this morning I
can tell you!<br>
<br>
It just needs to settle in and join the rest of the facts jostling
for top position on the "Don't forget..." list.<br>
<br>
Once again "list", I thank thee muchly for helping this troubador of
trouble travel the road to Haskell...<br>
<br>
:)<br>
<br>
<br>
</body>
</html>