Opened 11 months ago

Last modified 10 months ago

#11993 new feature request

RFC, allow local bindings in pattern synonyms

Reported by: Iceland_jack Owned by:
Priority: normal Milestone:
Component: Compiler Version:
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:

Description

Code from #11992, allow users to write something like

pattern Suc :: Int -> Int
pattern Suc n <- (hasSuc -> Just n)
  where Suc n = n + 1

        hasSuc :: Int -> Maybe Int
        hasSuc n = [ n - 1 | n > 0 ]

Change History (2)

comment:1 Changed 10 months ago by mpickering

I don't think this is a terrible idea but it does mean that the overloaded where could also be used in a non-overloaded way. I'm inclined to say that we should leave things as they are for now.

comment:2 Changed 10 months ago by Iceland_jack

It becomes a lot more worthwhile when you have local data and pattern synonym declarations because they interplay, I'll get back to this

Note: See TracTickets for help on using tickets.