
21 Oct
2009
21 Oct
'09
1:49 p.m.
2009/10/21 michael rice
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 function. Cheers, Thu