[Haskell-cafe] Unique monad?

David Leimbach leimy2k at gmail.com
Mon Mar 30 15:43:20 EDT 2009


On Mon, Mar 30, 2009 at 12: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
>
> http://www.haskell.org/ghc/docs/latest/html/libraries/base/Data-Unique.html
>
> 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:
>
> http://www.n-heptane.com/nhlab/repos/haskell-consumer/
>
> 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?).
>

One could argue that we don't need implementations any Monad, with perhaps
the exception of IO :-)

Dave


>
> - jeremy
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090330/e184c657/attachment.htm


More information about the Haskell-Cafe mailing list