plutus icon indicating copy to clipboard operation
plutus copied to clipboard

[Textual] Parse constants with parens

Open effectfully opened this issue 2 months ago • 2 comments

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.

effectfully avatar Oct 19 '25 11:10 effectfully

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.

carloskiki avatar Oct 19 '25 16:10 carloskiki

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.

effectfully avatar Oct 19 '25 18:10 effectfully