[Haskell-beginners] Global variables

Krzysztof Skrzętnicki gtener at gmail.com
Wed Jun 29 17:42:39 CEST 2011


You can store IORef / MVar / whatever in the environment. The counter is
supposed to be global, so it should work for multiple threads.

Best regards,
Krzysztof Skrzętnicki

On Wed, Jun 29, 2011 at 17:27, Christopher Done <chrisdone at googlemail.com>wrote:

> On 29 June 2011 17:22, Michael Xavier <nemesisdesign at gmail.com> wrote:
> > I tend to use Control.Monad.Reader for stateful stuff like this. It is
> found
> > in the mtl package
> > http://hackage.haskell.org/package/mtl-2.0.1.0
>
> How would you use reader for a counter?
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20110629/10800af3/attachment-0001.htm>


More information about the Beginners mailing list