Simple monads

Christian Maeder maeder@tzi.de
Fri, 27 Jun 2003 13:49:29 +0200


> The previous "newtype Labeller a = Labeller (Int -> (Int, a))" (the 
> result tuple is reversed within Control.Monad.State) would simply become 
> (untested):
> 
> newtype Labeller a = State Int a
> 
> newLabel = do { n <- get; put (n + 1); return (Label n) }
> 
> runLabeller l = execState l minBound

it must be "evalState" instead of "execState"