[Haskell-cafe] Indentation woes
Stefan O'Rear
stefanor at cox.net
Thu Jul 26 15:23:37 EDT 2007
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20070726/5f3f7622/attachment.bin
More information about the Haskell-Cafe
mailing list