Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#10932 closed feature request (duplicate)

Pattern synonyms and view pattern arguments

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


In my code, I had a few complicated patterns involving view patterns that depended on local arguments, i.e.

foo env (someView env -> Just x) = ...

I was hoping to be able to use PatternSynonyms to abstract and simplify this:

pattern Pat env x <- (someView env -> Just x)
foo env (Pat env x) = ...

but it says Not in scope: env.

It would be nice if I could use pattern synonyms here as well.

Change History (2)

comment:1 Changed 2 years ago by rwbarton

Resolution: duplicate
Status: newclosed

Duplicate of #9671. As discussed there, really needs some better syntax to distinguish the roles of env (argument to the pattern) and x (bound by the pattern) in Pat env x. (Presumably env could be any name in scope, not necessarily bound by the same equation.)

comment:2 Changed 2 years ago by simonpj

Yes... the tricky issue here is syntactic: how to make it clear what is bound and what is binding. Even when that's solved there'd be the question of how to write the type of Pat, which has a mixture of bound and bind args.

I honestly don't know how to resolve this, so for now it's just impossible to use pattern synonyms to abstract over view patterns that mention non-top-level functions.


Last edited 2 years ago by simonpj (previous) (diff)
Note: See TracTickets for help on using tickets.