On Thu, Jul 26, 2007 at 02:56:57PM -0400, anon wrote:
> Greetings,
> I wish to be able to indent my code like so:
>> longFunctionName various and sundry arguments
>> | guard1 = body1
>> | guard2 = body2
>> | ...
>> where declarations
> That is, with guards and where clauses indented to the same level as
> the function name.
>
> This seems like a perfectly reasonable indentation style to me. It
> also happens to be the preferred style in Clean, another
> layout-sensitive functional language. I believe it is not uncommon in
> ML dialects as well. So why is it that I'm not allowed to use it in
> Haskell?

Because in Haskell everything that is lined up is a new logical line.
Haskell requires all continuation lines to be indented:

longFunctonName various and sundry arguments
 | guard1 = body1
 | guard2 = body2
 | ..
 where declarations

As for "why", it's just a matter of Haskell Committee taste.  Nothing
too deep, just an arbitrary set of rules.

Stefan

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to