
#5144: Pattern synonyms -------------------------------------+------------------------------------ Reporter: simonpj | Owner: cactus Type: feature request | Status: new Priority: normal | Milestone: _|_ Component: Compiler | Version: Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Comment (by cactus): Replying to [comment:23 simonpj]:
I suggest we allow the user to control whether a pattern synonym is bidirectional or not. I'm not sure what syntax to use for that. We want to be able to say * Uni-directional pattern synonym * Bi-directional pattern synonym * Bi-directional pattern synonym with explicit user code for the reverse direction
Once a syntax for this is decided, this is trivial to add to my current implementation.
We have at various times discussed how to allow a module to export a data constructor that > can be used as a pattern but not as a constructor (in expressions), because the data type is abstract and you should only use a smart constructor. With pattern synonyms you can (almost) do that
What if you could just export `pattern P` (where `P` is the name of the data constructor) without having to define `AbsP`? Would that be taking things too far? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/5144#comment:25 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler