[Haskell-beginners] [Haskell-cafe] select :: [(Float, a)] -> a -- Weighted stochastic selection - help?

C.M.Brown cmb21 at kent.ac.uk
Sat Sep 6 06:04:10 EDT 2008


On Sat, 6 Sep 2008, Nicolas Pouillard wrote:

> Excerpts from C.M.Brown's message of Fri Sep 05 22:12:05 +0200 2008:
> > > Can you give an example? I don't see how that can be done using
> > > Control.Monad.State(.Strict).State, unless invocations of put or modify are
> > > considered side effects.
> >
> > Actually, yes, sorry; I do see your point. I guess it's just IO then.
>
> Technically, even the IO monad is pure, that's just the runtime-system
> that consume your 'main' function that perform effects (and unsafeP...).

But, sure the IO monad does have side-effects? I'm confused as to how it
could be pure. Could you explain?

> That's an important point to grasp about the way we do effects in a pure
> language.
>
> Once we've understood that point one tend to be a little less precise and
> consider IO as effect-full.

I consider IO to be effect-full anyway - I can't see how it isn't!

Thanks,
Chris.



More information about the Beginners mailing list