patch applied (haskell-prime-status): add ""Make $ left associative, like application"

Dan Doel dan.doel at gmail.com
Wed Apr 23 05:42:20 EDT 2008


On Wednesday 23 April 2008, Duncan Coutts wrote:
> withSomeResource foo $
>   withSomeOtherThing bar $
>     yetAnotherBlockStructured thing $ ...
>
> Does that work?

This wouldn't work, you'd have to rewrite it as:

    withSomeResource foo .
      withSomeOtherThing bar .
        yetAnotherBlockStructured thing $ ...

But it seems like your second example is more likely to come up for 'with' 
type blocks:

> Or
>
> withSomeResource foo $ \x ->
>   withSomeOtherThing bar $ \y ->
>     yetAnotherBlockStructured thing $ \z ->

That should work, because '\x ->' extends to the end of the expression. 
Similarly:

    iWantMonadicValues $ do foo
                            bar
                            iAlsoWantMonadicStuff $ do ...

still works.

-- Dan


More information about the Haskell-prime mailing list