[Haskell-cafe] Re: a regressive view of support for imperative programming in Haskell

Benjamin Franksen benjamin.franksen at bessy.de
Thu Aug 9 14:45:14 EDT 2007

David Roundy wrote:
> Several times since reading the beginning of this discussion I've wished I
> had the new syntax so I could write something like:
>   do if predicateOnFileContents (<- readFile "foo") then ...
> instead of either
>   do contents <- readFile "foo"
>      if predicateOnFileContents contents then ...
> or (as you'd prefer)
>   readFile "foo" >>= \contents ->
>   if predicateOnFileContents contents then ...

Isn't this problem, namely being forced to name intermediate results, also
solved by some sort of idiom bracket sugar, maybe together with the lambda
case proposal? I would prefer both very much to the proposed (<- action)
syntax for the same reasons that e.g. Jules Bean nicely summarized.


More information about the Haskell-Cafe mailing list