Writing a counter function

Peter G. Hancock peter@premise.demon.co.uk
30 Jun 2002 13:51:56 +0100

>>>>> lmichele  wrote (on Sun, 30 Jun 2002 at 09:26):

    > By the way, what's the purpose of this coding? (this is the type of
    > question: "ok, I have a hammer, now, for what kind of nail it is useful?")

I would guess that something like the asked-for counter could be
useful if one is allocating ranges of addresses to things, for example
heap nodes when compiling a function body to instructions to build a graph.

Why not have a monad m a = Int -> (a,Int) which is a state monad plus
the operation bump : Int -> m Int

 bump k n = (n,n+k) 

Peter Hancock