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

Jules Bean jules at jellybean.co.uk
Thu Aug 9 09:08:20 EDT 2007


David Roundy wrote:
> On Wed, Aug 08, 2007 at 02:20:39PM -0400, Paul Hudak wrote:
> As long as the sugar has a pretty obvious desugaring (which I seem to
> recall it did), I don't see how it's likely to make things worse.  And

Some people are arguing that the desugaring isn't obvious.

Although I like the proposal to start with, I am beginning to be 
convinced by those arguments.

For example:

 > do foo x

can be simplified to

 > foo x

under the new proposals

 > do x <- bar y
 >    foo x

would shorten to

 > do foo (<- bar y)

and now you really really want to remove the do, to get simply

 > foo (<- bar y)

but that would be illegal. The new sugar is going to remove all kinds of 
substitution and simplification lemmas that we have got used to.

There is also the fact that if :

foo x = bar x x

then you call foo monadically as in

do foo (<- baz)

You can no longer "replace foo with its definition", because if replace 
that with

do bar (<- baz) (<- baz)

...that means something rather different :(

A third example is with nested dos:

do x <- bar y
    baz
    something $ do foo x

is not the same as

do baz
    something $ do foo (<- bar y)

Jules


More information about the Haskell-Cafe mailing list