Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. Re: glfw cabal install mac osX (Bob Hutchison)
2. recommendations for a gnuplot tutorial (Michael Litchard)
3. Re: recommendations for a gnuplot tutorial (Elvio Toccalino)
4. how does the State monad actually work? (Sean Perry)
5. Re: how does the State monad actually work? (Benjamin Edwards)
6. Re: how does the State monad actually work? (Benjamin Edwards)
7. Re: how does the State monad actually work? (Erlend Hamberg)
8. Re: how does the State monad actually work? (Erlend Hamberg)
----------------------------------------------------------------------
Message: 1
Date: Mon, 23 May 2011 11:00:53 -0400
From: Bob Hutchison <[email protected]>
Subject: Re: [Haskell-beginners] glfw cabal install mac osX
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8
On 2011-05-19, at 2:06 PM, Daniel Fischer wrote:
> On Thursday 19 May 2011 19:31:11, Britt Anderson wrote:
>> I have just installed the haskell platform on a mac running 10.6 OSX.
>> Using cabal install glfw fails. Who would I write and what data should
>> I include to try and get some help to fix the problem? Thank you.
>
> What error message did cabl give? You may need to tell cabal to be more
> verbose if the standard verbosity doesn't give much information.
I've got a similar problem, lots of warnings and these errors:
glfw/lib/macosx/macosx_window.c:374:0:
error: ?typeLongInteger? undeclared (first use in this function)
glfw/lib/macosx/macosx_window.c:374:0:
error: (Each undeclared identifier is reported only once
glfw/lib/macosx/macosx_window.c:374:0:
error: for each function it appears in.)
glfw/lib/macosx/macosx_window.c: At top level:
glfw/lib/macosx/macosx_window.c:448:0:
error: ?kEventWindowDrawContent? undeclared here (not in a function)
glfw/lib/macosx/macosx_window.c: In function ?_glfwWindowEventHandler?:
Any hints would be appreciated.
Thanks,
Bob
>
> If you paste the output a hpaste.org and ask in #haskell (IRC channel,
> freenode.net), you'll likely find somebody there who knows what's going
> wrong.
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
----
Bob Hutchison
Recursive Design Inc.
http://www.recursive.ca/
weblog: http://xampl.com/so
------------------------------
Message: 2
Date: Mon, 23 May 2011 15:41:57 -0700
From: Michael Litchard <[email protected]>
Subject: [Haskell-beginners] recommendations for a gnuplot tutorial
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1
I've looked for a tutorial for using the Haskell gnuplot wrapper, and
can't find anything. If you can think of one off the top of your head,
please let me know. I'd like to see how to use it to generate 2D and
3D histograms expressed in a png (or any) file. As far as I can see,
the examples that come with gnuplot don't generate files.
------------------------------
Message: 3
Date: Tue, 24 May 2011 00:12:32 -0300
From: Elvio Toccalino <[email protected]>
Subject: Re: [Haskell-beginners] recommendations for a gnuplot
tutorial
To: [email protected]
Message-ID: <1306206754.1613.18.camel@el-fierro>
Content-Type: text/plain; charset="UTF-8"
Hi, Michael
Gnuplot has a simple way of outputing to files: prepare the plot you
want, tune it to your liking, and when you're ready use the 'set
terminal' and 'set output' command.
Basically, the terminal command tells gnuplot the format of the output
(png, jpeg, ps, etc), and the output tells it where you want it. A
simple example:
(... lines to prepare plot ...)
set terminal png
set output "mygraph.png"
replot
That replot line simply redraws your last plot... but now it draws to
the new terminal. When you want to draw back to X windows, set your
terminal to 'x11' or 'wxt' (your default terminal is shown right above
the prompt when you invoke gnuplot).
Any tutorial that teaches you how to plot is good, once you know how to
output the plot the way you want to.
On Mon, 2011-05-23 at 15:41 -0700, Michael Litchard wrote:
> I've looked for a tutorial for using the Haskell gnuplot wrapper, and
> can't find anything. If you can think of one off the top of your head,
> please let me know. I'd like to see how to use it to generate 2D and
> 3D histograms expressed in a png (or any) file. As far as I can see,
> the examples that come with gnuplot don't generate files.
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
------------------------------
Message: 4
Date: Tue, 24 May 2011 00:41:25 -0700
From: Sean Perry <[email protected]>
Subject: [Haskell-beginners] how does the State monad actually work?
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii
I am trying to understand how the State ends up in the function.
foo :: State Int String
foo = do
tmp <- get
put (tmp + 1)
return "blah"
when invoked as
print $ evalState foo 0
I get "blah" as expected. When I switch to execState I get the value 1. This is
what confuses me. Where is the State coming from if it is not passed into foo?
What are get and put operating on?
Desugared foo becomes:
(get >>= \tmp -> put (tmp + 1)) >> return "blah"
Which shows my confusion perfectly. Neither get nor put take a parameter. Why
is that? How does return know to include them in the new State value?
Especially considering the use of ">>".
Obviously I can use State instances following examples like this but I can not
reason with them since there is still a feeling of magic to them.
Thanks.
------------------------------
Message: 5
Date: Tue, 24 May 2011 08:50:19 +0100
From: Benjamin Edwards <[email protected]>
Subject: Re: [Haskell-beginners] how does the State monad actually
work?
To: Sean Perry <[email protected]>
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"
I highly recommend reading some of the tutorials that show how to derive the
state monad. The type of state is really a function that takes a parameter
and returns a state tupled with a value. Yet another haskell tutorial has
quite a good chapter on this.
On 24 May 2011 08:40, "Sean Perry" <[email protected]> wrote:
I am trying to understand how the State ends up in the function.
foo :: State Int String
foo = do
tmp <- get
put (tmp + 1)
return "blah"
when invoked as
print $ evalState foo 0
I get "blah" as expected. When I switch to execState I get the value 1. This
is what confuses me. Where is the State coming from if it is not passed into
foo? What are get and put operating on?
Desugared foo becomes:
(get >>= \tmp -> put (tmp + 1)) >> return "blah"
Which shows my confusion perfectly. Neither get nor put take a parameter.
Why is that? How does return know to include them in the new State value?
Especially considering the use of ">>".
Obviously I can use State instances following examples like this but I can
not reason with them since there is still a feeling of magic to them.
Thanks.
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20110524/230abdb8/attachment-0001.htm>
------------------------------
Message: 6
Date: Tue, 24 May 2011 09:28:13 +0100
From: Benjamin Edwards <[email protected]>
Subject: Re: [Haskell-beginners] how does the State monad actually
work?
To: Sean Perry <[email protected]>
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"
That should gave been state is a type that takes a state and returns a state
tupled with a value. The chapter in yaht is 9.3
On 24 May 2011 08:50, "Benjamin Edwards" <[email protected]> wrote:
I highly recommend reading some of the tutorials that show how to derive the
state monad. The type of state is really a function that takes a parameter
and returns a state tupled with a value. Yet another haskell tutorial has
quite a good chapter on this.
>
> On 24 May 2011 08:40, "Sean Perry" <[email protected]> wrote:
>
> I am trying to understand ...
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20110524/e7be6f4b/attachment-0001.htm>
------------------------------
Message: 7
Date: Tue, 24 May 2011 11:00:17 +0200
From: Erlend Hamberg <[email protected]>
Subject: Re: [Haskell-beginners] how does the State monad actually
work?
To: Sean Perry <[email protected]>
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1
On 24 May 2011 09:41, Sean Perry <[email protected]> wrote:
> when invoked as
>
> print $ evalState foo 0
>
> I get "blah" as expected. When I switch to execState I get the value
> 1. This is what confuses me. Where is the State coming from if it is
> not passed into foo? What are get and put operating on?
If you write it like this
print $ (execState foo) 0
and note that
execState foo :: Int -> Int
it's easier to see that evalState foo returns a *function* that takes an
initial state and then operates on this.
Hope this makes it a bit clearer. :-)
--
Erlend Hamberg
[email protected]
------------------------------
Message: 8
Date: Tue, 24 May 2011 11:03:19 +0200
From: Erlend Hamberg <[email protected]>
Subject: Re: [Haskell-beginners] how does the State monad actually
work?
To: Sean Perry <[email protected]>
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1
On 24 May 2011 11:00, Erlend Hamberg <[email protected]> wrote:
> it's easier to see that evalState foo returns a *function* that takes an
> initial state and then operates on this.
D'oh. I meant execState, of course. :-)
--
Erlend Hamberg
[email protected]
------------------------------
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
End of Beginners Digest, Vol 35, Issue 46
*****************************************