ormolu
ormolu copied to clipboard
Why is "where" on next line in "module" declaration?
Ormolu styles export lists as
module Foo
( foo,
bar,
)
where
with where
on the same column as module
. I couldn't find any documentation with why it was styled this way (it seems to have always been this way: https://github.com/tweag/ormolu/commit/120b4caefccdf754aab43c0152094d4176bc71be#diff-876cfc4e497be459e0775f2ca9223b817c71df6cc489e1a554d49cfa36fd4b4fR52).
My immediate reaction is that this would be a syntax error, as where
is always indented past the parent context, e.g. this is a syntax error:
foo =
bar other
where
other = ...
and I would expect the module header to instead be
module Foo
( foo,
bar,
) where
If this was an intentional design decision, I'm curious what the reason was. If it wasn't, I wonder if people would prefer where
to be indented, and if it's worth making a change here.
Duplicate of #409.
I think this is slighly different from #409 in that the emphasis there is the parentheses placement for diff-reasons, and the primary reason for closing the PR was to reuse the parens combinator. Here, the question is about the where
placement for aesthetic/syntax consistency reasons. But couldnt you reuse the combinator while keeping the where
on the same line as the last parens? Or even keeping it on the next line but indenting the where
2 spaces?
I'm just curious if there's a specific reason for the where
being on column 0; I don't think this is specifically answered in #409
@mrkkrp any chance to resolve this one way or another please? I've been surprised to see this formating for the same reason as @brandonchinn178, so it would be interesting to know which design principles are behind it, but even a simple acknowledgement that this is an intended behaviour which is not going to change would be helpful.
This is, indeed, an intended behavior and is unlikely to change at this point.