dhall-haskell icon indicating copy to clipboard operation
dhall-haskell copied to clipboard

confusing error on empty list in record

Open marcosh opened this issue 4 years ago • 3 comments

When Dhall tries to parse

{ a = ""
, b = []
}

it reports the error message

Error: Invalid input

(input):2:3:
  |
2 | , b = []
  |   ^
unexpected 'b'
expecting whitespace or }

while I would expect an Empty list literal without annotation error message

marcosh avatar May 27 '21 06:05 marcosh

This is an issue with the dhall-haskell implementation, so I've transferred it.

sjakobi avatar May 27 '21 09:05 sjakobi

I wonder whether there's a connection to https://github.com/dhall-lang/dhall-haskell/issues/1592 and whether anything can be improved here without radically overhauling the parser.

sjakobi avatar May 27 '21 09:05 sjakobi

The reports in #2264 and #2265 are very similar:

Error: Invalid input

(input):1:14:
  |
1 | { a = "foo", b = "\e" }
  |              ^
unexpected 'b'
expecting whitespace or }
Error: Invalid input

(input):1:12:
  |
1 | { a = "a", b = { a = "foo",, } }
  |            ^
unexpected 'b'
expecting whitespace or }

sjakobi avatar Jul 25 '21 13:07 sjakobi