[Haskell-cafe] Indentation woes
nicolas.frisby at gmail.com
Thu Jul 26 15:58:21 EDT 2007
A bandaid suggestion:
longFunctionName various and sundry arguments = f where
f | guard1 = body1
f | guard2 = body2
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
On 7/26/07, Stefan O'Rear <stefanor at cox.net> 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.
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
> -----END PGP SIGNATURE-----
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
More information about the Haskell-Cafe