[GHC] #8581: Add support for explicitly-bidirectional pattern synonyms

GHC ghc-devs at haskell.org
Fri Aug 22 08:46:09 UTC 2014


#8581: Add support for explicitly-bidirectional pattern synonyms
-------------------------------------+-------------------------------------
              Reporter:  cactus      |            Owner:  cactus
                  Type:  feature     |           Status:  closed
  request                            |        Milestone:  7.10.1
              Priority:  normal      |          Version:
             Component:  Compiler    |         Keywords:
            Resolution:  fixed       |     Architecture:  Unknown/Multiple
      Operating System:              |       Difficulty:  Unknown
  Unknown/Multiple                   |       Blocked By:  5144
       Type of failure:              |  Related Tickets:
  None/Unknown                       |
             Test Case:              |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 It's a bit hard to understand your example because you don't give any
 types, or any code that you think should work, but doesn't.

 But I ''think'' you mean this: the two directions of an explicitly-
 bidirectional pattern might have utterly different class constraints.
 After all, the two directions are specified by quite different code.
 Suppose that
  * Pattern `P` (used in a pattern) ''requires'' constraints `CR`, and
 ''provides'' constraints `CP`
  * Constructor `P` (used in an expression) requires constraints `CE`
 Then I think the only required relationship is this: `CP` must be provable
 from `CE` (since `CP` is packaged up in a P-object).

 Is this what you meant?  Then indeed I think that we have not really
 discussed this possibility at all.

 There is a tricky UI issue, which is how to say when you ask `:info P`.
 And, worse still, what it would mean to give a type signature to `P`.

 So it looks to me, on first impression, that what you want is do-able and
 sensible.  But there are some design issues to work out first.  Let's see
 what Gergo has to say.

 Simon

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8581#comment:10>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list