Newbie question on "statefullness"

John Meacham john@repetae.net
Mon, 12 Aug 2002 04:19:38 -0700


grr. this used to be in a FAQ at the Wiki. whatever happened to that?
The haskell wiki was just starting to pick up and gain momentum and now
it disapeared. how about we migrate the content to a more stable Wiki
platform?

http://c2.com/cgi/wiki?WikiEngines

	John

On Mon, Aug 12, 2002 at 11:27:44AM +1000, Andrew J Bromage wrote:
> G'day all.
> 
> On Sun, Aug 11, 2002 at 05:36:21PM -0700, Alex Peake wrote:
> 
> > I am new to Haskell. I want to do something very simple (I thought)
> > but got lost in the world of Monads.
> > 
> > I want to implement something like the C idea of:
> > n += i
> > 
> > So how does one doe this in Haskell?
> 
> I think this needs to be an FAQ.
> 
> The short answer is that if you find yourself needing to do this,
> especially if you're new to Haskell, you're probably thinking about
> the problem in the wrong way.  Haskell does not support the "n += i"
> idiom in the same way that C does not support, say, higher-order
> functions.
> 
> The flip side is that Haskell _does_ support the "n += i" idiom in
> the same way that C _does_ support higher-order functions, in that
> with some effort (sometimes a little, sometimes a lot) you can simulate
> the same functionality if you find you really need it (using monads,
> continuations or whatever).  However, most of the time where you
> would use this idiom in C, you would not use it in the equivalent
> Haskell program, simply because there's usually a more appropriate
> way of phrasing your intentions.
> 
> Cheers,
> Andrew Bromage
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
> 

-- 
---------------------------------------------------------------------------
John Meacham - California Institute of Technology, Alum. - john@foo.net
---------------------------------------------------------------------------