[Haskell-cafe] Smarter do notation

Daniel Peebles pumpkingod at gmail.com
Sun Sep 4 09:12:29 CEST 2011

Good idea! I'd forgotten about monad comprehensions.

On Sun, Sep 4, 2011 at 3:11 AM, Shachaf Ben-Kiki <shachaf at gmail.com> wrote:

> On Sat, Sep 3, 2011 at 19:34, Daniel Peebles <pumpkingod at gmail.com> wrote:
> ...
> > Of course, the fact that the return method is explicitly mentioned in my
> > example suggests that unless we do some real voodoo, Applicative would
> have
> > to be a superclass of Monad for this to make sense. But with the new
> default
> > superclass instances people are talking about in GHC, that doesn't seem
> too
> > unlikely in the near future.
> ...
> One way to avoid explicitly mentioning return would be to use monad
> comprehension syntax, which uses return implicitly, instead of do
> notation. This also has the advantage of being "new" in GHC 7.2,
> rather than officially being part of Haskell 98/2010, and therefore
> being more amenable to various extensions (e.g. there are already
> extensions that use MonadPlus/MonadZip/MonadGroup). Applicative would
> probably still have to be a superclass of Monad, but the translation
> of this syntax is simpler.
>    Shachaf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110904/3e22c3e3/attachment.htm>

More information about the Haskell-Cafe mailing list