[Haskell-cafe] monad subexpressions

Jules Bean jules at jellybean.co.uk
Fri Aug 3 10:39:16 EDT 2007


Dan Piponi wrote:
> On 8/3/07, Jules Bean <jules at jellybean.co.uk> wrote:
>> do
>>    a <- m
>>    b <- n
>>    l a x b y
>>
>> becomes
>>
>> l (<- m) x (<- n) y
> 
> Couldn't this be best done with McBride and Patterson's Applicative
> idiom notation?
> 
> So the above would become
> 
> [[l m (pure x) n (pure y)]]      (or something like that)
> 
> It would have the advantage of being usable with any Applicative, not
> just Monads.


Well that's exactly the kind of discussion I was trying to generate.

And I did give an applicative version when I replied to myself (although 
not admittedly full scale idiom brackets)

Jules



More information about the Haskell-Cafe mailing list