First, a preface to my comments on layout processing:  it seems to me
that the purpose of the layout rules is to give the programmer FOWIM
(Figure Out What I Mean) syntax.  Hence, if it isn't immediately clear
to a human reader what grouping is intended, then the layout rules are
not helping.  Furthermore, if the savvy human reader can interpret the
grouping *wrongly* at first glance, then the layout rules are getting in
the way, causing obfuscation rather than clarity.

| But the real problem, in my opinion, is in allowing empty where clauses,
| which seems like a pretty dubious feature, and a redundant one also; if
| you want it to be empty, don't write the "where" either!

I agree.  The rule that `where' always introduces a new layout scope is
clear and easy to grasp and remember.  The idea of an invisible empty
declaration list, which somehow modifies the former rule (or appears
to) on certain occasions, is not so easy to remember.

To put it another way, in the following declaration:
    class M a where
    m :: a
    m = ...
what is more likely to be the programmer's intention?  A class with an
empty definition?  Or a class with member m, albeit with a slightly
unusual interpretation of the basic layout rule?  In the former case,
the programmer is surely much more likely to write simply
    class M a
    m :: a
    m = ...
omitting the keyword `where' altogether.

| I suppose the real issue is concerned with the
| error diagnostic that any given Haskell implementation might give
| in this situation.

If we are to keep the strictly indenting rule, then perhaps an empty
`where' clause should generate a warning - non-fatal, but it might
alert a sleepy programmer to a mistake.

| Something like the following can be used in Hugs 98:
| 
|   f x = case x of
|         (a,b) -> case a of
|         (c,d) -> case b of
|         (e,f) -> [c,d,e,f]

You can't be serious!  This is a great example of mis-using layout to
baffle and bemuse.

Regards,
    Malcolm



Reply via email to