purescript-language-cst-parser
purescript-language-cst-parser copied to clipboard
Indented root layout not supported?
module M where
i :: Int
i = 1
purs-tidy check src/M.purs
replies with
Some files have errors:
/home/me/purs-test/src/M.purs:
[6:1] Unexpected end of file
I'm pretty sure that's just invalid syntax. Top-level declarations cannot be indented.
It compiles fine though? https://try.purescript.org/?code=LYewJgrgNgpgBAWQIYEsB2cDuALGAnGAKELjhTgC4K4BJNAFxLLgF44BGQoA
This syntax was definitely supported originally because we allowed multiple modules per file, so you'd have like
module X where
def1 :: ...
module Y where
def2 :: ...
so it may have been preserved since then in the main compiler.
I wouldn't recommend writing code this way as it's completely unnecessary (I personally think some kind of syntax error is appropriate), but if the main compiler supports it, we probably should as well.