Indentation of If-Then-Else

Brian Smith brianlsmith at gmail.com
Sun Oct 22 11:23:00 EDT 2006


On 10/22/06, Neil Mitchell <ndmitchell at gmail.com> wrote:
>
> Hi
>
> > In order to solve the trouble I propose enhancements
> > to teachers, compilers and standard libraries:
> > 1. 'if' syntax should be teached as
> >      if a
> >        then b
> >        else c
>
> I love being able to ident if however I like:


I agree with Henning. Reserved syntax for "if" is totally unnecessary in
Haskell. It requires three keywords. Its costs (syntax wise) seem much
greater than its benefits (which are practically zero). I don't think that
it makes sense to make further complicate this unnecessary syntax. Instead,
why not work on eliminating the special syntax altogether? For example, make
the "then" and "else" keywords optional and schedule them for removal in the
next revision.

Hennings suggestion that implementations suggest the correct indention is a
good one.  The existing Haskell implementations do not do a good job
diagnosing layout problems. As far as I know, they don't even try to recover
from syntax errors at all. I would like to change both of these problems.
The proposed layout changes (NondecreasingIndention and DoAndifThenElse and
the one for case) should be postponed until more work on error diangosis and
recovery has been done.

Regards,
Brian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-prime/attachments/20061022/081f5dd0/attachment.htm


More information about the Haskell-prime mailing list