-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shine is Utterly Broken #25
Comments
Some of this also hinges on our language being whitespace agnostic. I talked with Harlan, and we agreed on “whitespace equivalence” being an OK thing to shoot for in theory. In practice, this means we will warn when “equivalent” whitespace is used at the beginnings of lines instead of equal whitespace. I’ve come up with these rules Whitespace SequencesFor a token Whitespace EquivalenceTwo tokens with whitespace sequences Whitespace EqualityTwo tokens with whitespace sequences Whitespace OrderingFor two tokens with whitespace sequences |
Would be nice to throw this in a doc in |
We can't accept all of Haskell's rules. I've modified them accordingly: NotationLet Suppose the whitespace sequence The operator The shining procedure The Rules of Layout (The Shining)
|
Note that, by these rules, we break what would usually be whitespace ambiguities like -- [t] = tab
-- [s] = space
module Foo
[s][s]module Bar
[s][s][t]module Baz
[s][t][s]module Bat
[s][s][s][t]module Quux as -- [t] = tab
-- [s] = space
module Foo {
[s][s]module Bar {
[s][s][t]module Baz {}
[s][t][s]module Bat {}
[s][s]}
[s][s][s][t]module Quux {}
} |
Note that this may be counterintuitive, so when the rule that causes the last line to wind up in the top-level layout block instead of in Bat's layout block fires, we will diagnose this with a warning. |
Still a bit broken. module DataDecl where
data Foo : Set where
| Foo : nat -> nat -> Foo
| Bar : nat -> Foo The shined output is: module DataDecl where {
data Foo : Set where { };
| Foo : nat -> nat -> Foo;
| Bar : nat -> Foo;
}; |
Unless those are supposed to be indented, at which point never mind |
Actually, the diagnostic for this suuuuucks so bad.
|
Anything under a where clause should be strictly more indented than the enclosing context unless you are the top-level module. |
Yes, and I think we could recognize a large set of mistakes here with diagnostics. |
Absolutely. Whitespace ambiguities and mismatches should be diagnosed in Shine. All the infrastructure is there to do it too... |
Serves me right for thinking I could do better than the Haskell report. The code, as it stands, is insufficient to detect at least these conditions
=>
=>
The text was updated successfully, but these errors were encountered: