[GHC] #12428: Allow pattern synonyms to optionally carry coerceability

GHC ghc-devs at haskell.org
Tue Aug 16 12:00:49 UTC 2016


#12428: Allow pattern synonyms to optionally carry coerceability
-------------------------------------+-------------------------------------
        Reporter:  dfeuer            |                Owner:
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:  8.2.1
       Component:  Compiler          |              Version:  8.0.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 Joachim is right. This has really has nothing to do with pattern synonyms.
 It would apply just as much if instead of `pattern NewFoo` we offered
 {{{
 getFoo :: Foo a -> a
 getFoo (Foo (Bar x)) = x
 }}}
 Now I suppose you might want to
  * Export the type `Foo` and function `getFoo`, but not the data
 constructors `Foo` and `Bar`.
  * And still get `(Coercible (Foo a) a)` in importing modules, although
 the relevant data constructors are not in scope.

 Yes, that's possible.  If lots of people want it, I guess we can look for
 some way to control the export of the `Coercible` instance.  But it's
 rather orthogonal to pattern synonyms.

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


More information about the ghc-tickets mailing list