[Haskell-cafe] Smarter do notation

Max Bolingbroke batterseapower at hotmail.com
Mon Sep 5 09:43:41 CEST 2011

On 5 September 2011 08:35, Max Bolingbroke <batterseapower at hotmail.com> wrote:
> (If you do want to support the type checker only generating requests
> for an Applicative constraint you could just insist that user code
> writes "pure" instead of "return", in which case this would be quite
> easy to implement)

I take back this parenthetical remark. Using pure instead of return
only solves the most boring 1/2 of the problem :-)

Using the Applicative methods to optimise "do" desugaring is still
possible, it's just not that easy to have that weaken the generated
constraint from Monad to Applicative since only degenerate programs
like this one won't use a Monad method:

do computation1


More information about the Haskell-Cafe mailing list