plutus
plutus copied to clipboard
[Textual] Parse constants with parens
This makes the parse recognize constants with extra parens in them as requested in #7383.
I don't feel like we want to make any of those extra parens mandatory, but there's no harm in being lenient and parsing them.
I'm not sure this is better. I would rather have an inconsistent syntax with a single way of doing things, than a partially consistent syntax with non-canonical ways of doing things.
I don't care either way.
My justification is that for constants we mostly reuse Haskell syntax and there parsing of redundant parens is mostly supported:
>>> read "[(True),(False)]" :: [Bool]
[True,False]
>>> read "[((1,2)),((3,4))]" :: [(Int, Int)]
[(1,2),(3,4)]
>>> read "[((1,2),(3,4))]" :: [((Int, Int), (Int, Int))]
[((1,2),(3,4))]
If any of the reviewers don't like this PR, feel free to close it.