[Haskell-cafe] Unique monad?
lennart at augustsson.net
Mon Mar 30 15:57:02 EDT 2009
I think Data.Unique is horrible and should be banned.
It encourages a global variable style of programming that will just
bite you in the end.
On Mon, Mar 30, 2009 at 8:40 PM, Jeremy Shaw <jeremy at n-heptane.com> wrote:
> 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?.
> It's here:
> 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
> somewhere else?).
> - jeremy
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
More information about the Haskell-Cafe