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: Architecture and monads (Heinrich Apfelmus)
2. whats up (David Schonberger)
----------------------------------------------------------------------
Message: 1
Date: Tue, 07 Dec 2010 18:31:51 +0100
From: Heinrich Apfelmus <[email protected]>
Subject: Re: [Haskell-beginners] Architecture and monads
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=UTF-8; format=flowed
Amy de Buitl?ir wrote:
> Until recently, the choice of whether or not to use monads was easy. I
> didn't understand them, so I avoided them! But now that I think I
> understand enough to begin to use them, I have a different problem: I
> don't have the experience to know when using them is a good idea, and
> when it's overkill. This is my first serious Haskell project, and I
> would appreciate any advice.
>
> Here's the scenario: I'm developing a virtual world with alife
> creatures. [...] One
> issue that complicates things slightly is that a *lot* of the
> processing I'm doing requires random numbers.[...]
My advice is this: instead of using a state monad, use a monad that has
an independent interpretation. (You may *implement* it in terms of the
state monad, but you may not *think* of it as a state monad).
My favorite example is the "random number monad" Rand . Namely, the
declaration
x :: Rand a
denotes a random variable x of values of type a . You would usually
implement it as a state monad
type Rand a = StdGen -> (a,StdGen)
but it is preferable to think of it as a random variable in the
mathematical sense, which is completely independent of any notion of
state. See also
http://lukepalmer.wordpress.com/2009/01/17/use-monadrandom/
http://apfelmus.nfshost.com/articles/random-permutations.html
> Generally speaking, is it best to go for the "bon-bon" approach, with
> a pure functional core, and a monadic layer on the outside?
If you cannot find an independent interpretation, the "bon-bon" approach
is usually a good idea.
Regards,
Heinrich Apfelmus
--
http://apfelmus.nfshost.com
------------------------------
Message: 2
Date: Tue, 7 Dec 2010 21:27:36 -0800
From: David Schonberger <[email protected]>
Subject: [Haskell-beginners] whats up
To: <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"
making all this money has always been a dream for me i found this all out on a
web site off the internet one of my new hobby's is traveling i was making money
immediately http://www.cnbc1000news.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20101207/2a9cbf1e/attachment.html>
------------------------------
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
End of Beginners Digest, Vol 30, Issue 10
*****************************************