Opened 4 years ago

Last modified 4 years ago

#11212 new bug

Should be more liberal parsing pattern synonyms with view patterns

Reported by: mpickering Owned by:
Priority: normal Milestone:
Component: Compiler (Parser) Version: 7.10.3
Keywords: PatternSynonyms Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


Redundant parentheses are required around a view pattern if it is used on the RHS of a pattern synonym definition. I think that parsing should be relaxed to allow the first definition.

-- Fails to parse, bug?
pattern IsTrue :: Show a => a
pattern IsTrue <- (== "True") . show -> True

-- Parses
pattern IsTrue :: Show a => a
pattern IsTrue <- ((== "True") . show -> True)

Change History (3)

comment:1 Changed 4 years ago by thomie

Component: CompilerCompiler (Parser)

comment:2 Changed 4 years ago by simonpj

I'm not sure actually. The former is really quite hard to parse, to my eyes!

But I don't feel strongly.

comment:3 Changed 4 years ago by thomie

With -XMultiWayIf, if | Just True <- Just True -> True is a valid expression. It looks similar to the example in this ticket: two arrows in opposite directions, no parenthesis.

Note: See TracTickets for help on using tickets.