natefaubion / purescript-language-cst-parser

PureScript CST Parser written in PureScript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Indented root layout not supported?

postsolar opened this issue · comments

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.

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.