[GHC] #10932: Pattern synonyms and view pattern arguments

#10932: Pattern synonyms and view pattern arguments -------------------------------------+------------------------------------- Reporter: nomeata | Owner: Type: feature | Status: new request | Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | -------------------------------------+------------------------------------- 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. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10932 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10932: Pattern synonyms and view pattern arguments -------------------------------------+------------------------------------- Reporter: nomeata | Owner: Type: feature request | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: duplicate | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): -------------------------------------+------------------------------------- Changes (by rwbarton): * status: new => closed * resolution: => duplicate Comment: 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.) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10932#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10932: Pattern synonyms and view pattern arguments -------------------------------------+------------------------------------- Reporter: nomeata | Owner: Type: feature request | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: duplicate | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): -------------------------------------+------------------------------------- Comment (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. Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10932#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC