[Haskell-cafe] extending Do notation

silvio silvio.frischi at gmail.com
Tue May 20 19:47:47 UTC 2014

On 05/20/2014 08:44 PM, Tillmann Rendel wrote:
> Hi,
> silvio wrote:
>>  [...] This should cover the lambda
>> question and the nested question.
> No, I don't understand how this covers the lambda case. For example, how
> is the following desugared:
>   do print (map (\name -> {readFile name}) ["foo", "bar"])
> It would be convenient if this would mean something like:
>   do contents <- mapM (\name -> readFile name) ["foo", "bar"]
>      print contents

I see sorry I didn't consider that there would be new variables.

syntax changed from {exp} to (<-exp)

An other thing to consider is functions. This seems really awesome
syntax. Unfortunately, this might cause some troubles because functions
can be monads.

do print map (<-readFile) ["foo","bar"]


More information about the Haskell-Cafe mailing list