[GHC] #15827: Explicit foralls in type family equations are pretty-printed inconsistently (and strangely, at times)

GHC ghc-devs at haskell.org
Mon Nov 26 18:57:23 UTC 2018


#15827: Explicit foralls in type family equations are pretty-printed inconsistently
(and strangely, at times)
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:  (none)
            Type:  bug               |               Status:  patch
        Priority:  normal            |            Milestone:  8.8.1
       Component:  Compiler          |              Version:  8.7
      Resolution:                    |             Keywords:  TypeFamilies
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D5282
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by Ryan Scott <ryan.gl.scott@…>):

 In [changeset:"f932b1aa42f45625658c8abaf862cc570507c5ca/ghc" f932b1a/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="f932b1aa42f45625658c8abaf862cc570507c5ca"
 Print explicit foralls in type family eqns when appropriate

 Summary:
 When `-fprint-explicit-foralls` is enabled, type family
 equations are either printed without an explict `forall` entirely,
 or with a bizarre square bracket syntax (in the case of closed type
 families). I find neither satisfying, so in this patch, I introduce
 support for printing explicit `forall`s in open type-family, closed
 type-family, and data-family equations when appropriate. (By "when
 appropriate", I refer to the conditions laid out in
 `Note [When to print foralls]` in `IfaceType`.)

 One tricky point in the implementation is that I had to pick a
 visibility for each type variable in a `CoAxiom`/`FamInst` in order
 to be able to pass it to `pprUserIfaceForAll` //et al.// Because
 the type variables in a type family instance equation can't be
 instantiated by the programmer anyway, the choice only really matters
 for pretty-printing purposes, so I simply went with good ol'
 trustworthy `Specified`. (This design choice is documented in
 `Note [Printing foralls in type family instances]` in `IfaceType`.)

 Test Plan: make test TEST=T15827

 Reviewers: goldfire, bgamari, simonpj

 Reviewed By: simonpj

 Subscribers: simonpj, rwbarton, carter

 GHC Trac Issues: #15827

 Differential Revision: https://phabricator.haskell.org/D5282
 }}}

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


More information about the ghc-tickets mailing list