As an author of an Haskell Emacs mode that deals with the layout rule
(described in Journal of Functional Programming 8(5) 493-502), I
strongly agree that the "parse-error condition" is really a bad idea.
For example, in Emacs, no full Haskell parse is done.

After all, layout should be there to indicate clearly to a user what
section of code depends on which other; the user should not have to parse
and deal with some local fixity declarations.

I know this suggestion would break a few Haskell programs but perhaps
it should be interesting to come back to the first functional language
that implemented the layout rule, Miranda (tm) where the rule was much
more simply stated

  Syntactic objects obey Landin's offside rule.  This requires that
  every token of the object lie directly or to the right of its first
  token.  A token which breaks this rule is said to offside with
  respect to that object.

And that's it... no need to have three pages of explanations and an
appendix.  

One can find many examples where Haskell rules and Miranda
differ and some times one is better than the other, but you would be
surprised to see that in the majority of the cases, the indentation
that people normally produce are very similar under both rules.

Guy Lapalme
Université de Montréal

PS: as a Quiz, can you guess how in Haskell the following is interpreted?

f x = 1 + x
 g y = 1 + y




Reply via email to