Indentation of If-Then-Else

John Meacham john at repetae.net
Mon Oct 23 11:10:56 EDT 2006


On Mon, Oct 23, 2006 at 01:36:41PM +0100, Henrik Nilsson wrote:
> The background to the proposal was that Haskell 98 prevents
> an arguably reasonable style of indentation, and that this
> has turned out to be a problem in practice: i.e. it tends to
> trip up a lot of unsuspecting people, in particular beginners.
> 
> Yes, one can argue that they should learn "the right way",
> but this is really a very minor detail that many think would
> be best if people didn't have to worry about in the first place.

It is not even clear to me that there is a single right way. the proper
indentation style for if statements  depends on both context, the
subexpressions and the structure of the term you want to
emphasize/subdue.  

> The proposal is actually very lightweight (just allow an
> optional ";" in the appropriate place), and thus it is not
> even a question about new "syntactic sugar". At least not
> according to my understanding of the term. Also, it
> does not complicate the (already complicated) layout rules
> further, which is quite important.
> 
> If I recall correctly, the proposal was implemented in GHC
> (and JHC?) shortly after it had been put forward, with
> very little effort indeed, and has not caused any ill
> side effects that I'm aware of.

Yes. It was implemented in jhc within a couple hours of the idea being
proposed (the implementation itself taking a couple minutes). all of
jhc's standard libraries compliled without problem with the extension
enabled and no issues have arisen from it always being enabled.

        John

-- 
John Meacham - ⑆repetae.net⑆john⑈


More information about the Haskell-prime mailing list