The Do-Let-Braces problem

Sebastien Carlier
Thu, 15 Feb 2001 06:51:01 +0000

Mark Utting wrote:
> Summary: Haskell layout has problems within 'do' (see below).
>          Can we change Haskell to improve it?

I don't think the language has to be changed.  It seems to me that the
problems is more with the idea of editing the source code as plain text.
Ideally, I would like an editor be able to draw a pretty square bracket
(graphically, or with semi-graphic characters) around blocks, a bit like
> f3 = 
>     do |~ putStr "Enter Data: "
>        |  line <- getLine
>        |  let line2 = line
>        |_ putStr line2

XEmacs could probably be tricked into doing that, but it seems quite
difficult.  And you would have to redefine most key bindings so that
it behaves correctly.
You may have a look at Mjolner (,
it is a development environment for BETA with a hierarchical editor which
works in a similar way.  It wouldn't be adequate for Haskell, but it
demonstrates the idea.
By the way, with a proper editor, you wouldn't even need the layout rule.
Source code would be stored with explicit bracing, and the editor could
hide all these cluttering symbols, or display them in any fancy way you

Sebastien Carlier