[Haskell-cafe] Simple but interesting (for me) problem

minh thu noteed at gmail.com
Wed Oct 21 13:49:13 EDT 2009

2009/10/21 michael rice <nowgate at yahoo.com>
> There's a thread on the plt-scheme list about creating a function of NO arguments named NEXT that just returns the number of times it's been called, a piece of cake in Scheme, but how would one do this in Haskell? Would the best approach be to use a State monad?

If you really want no argument, not just syntactically in the do
notation, you need ST or IO. Furthermore, you need ST or IO to
allocate a mutable variable that is accessible only to the next


More information about the Haskell-Cafe mailing list