[Haskell-cafe] Unique monad?
jeremy at n-heptane.com
Mon Mar 30 15:40:12 EDT 2009
At Mon, 30 Mar 2009 20:29:14 +0100,
Andrew Coppin wrote:
> Maybe I'm just being blind here, but I don't see a monad transformer (or
> even a monad) in the standard libraries for producing "unique" values.
> Have I missed something?
There is Data.Unique
Not sure if that is suitable for your needs. Obviously it doesn't do
everything that one might desire.
> Related, I don't see a monad for gradually consuming input. We've got
> the Reader monad, but that appears to just give you global access to a
> single monolithic value.
> (I guess ultimately you can build all these specialised monads out of
> the general State monad if you want. I'm just surprised they're not
> already defined somewhere...)
I have written a Consumer monad, but I never uploaded it to hackage,
because, as you say, it seemed like it should just be a specialized
version of the State monad?.
If people think it is actually valuable, I'll upload it. I would be
interested in hearing some debate about what I wrote, versus just
implementing it on top of the State monad, if anyone has something to
say about that.
Since the Reader and Writer monads could be implemented as specialized
version of State, maybe that is an argument for implementing Consumer
as I have? (Also, I get the feeling this Consumer monad already exists
More information about the Haskell-Cafe