|
|
A bandaid suggestion:
longFunctionName various and sundry arguments = f where
f | guard1 = body1
f | guard2 = body2
| ...
where declarations
(Disclaimer: untested)
As I understand it, there can be guards on the definition of f even if
it takes no arguments. Those guards can reference your the various and
sundry arguments.
On 7/26/07, Stefan O'Rear <stefanor@xxxxxxx> wrote:
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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFGqPS5FBz7OZ2P+dIRAgwbAKCl3ssl6X42VqSZJnhgKVH7WSzRXwCaA3x5
Ze0lGvx17IDrFXxBEvVxGeI=
=5/To
-----END PGP SIGNATURE-----
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@xxxxxxxxxxx
http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@xxxxxxxxxxx
http://www.haskell.org/mailman/listinfo/haskell-cafe
|
|