[GHC] #8776: Displaying pattern synonym for a GADT

GHC ghc-devs at haskell.org
Sat Feb 15 02:26:42 UTC 2014


#8776: Displaying pattern synonym for a GADT
-------------------------------------+------------------------------------
        Reporter:  monoidal          |            Owner:
            Type:  bug               |           Status:  new
        Priority:  normal            |        Milestone:
       Component:  Compiler          |          Version:  7.7
      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):

 When you do a `:t P` in GHCi, it runs `PprTyThings.pprPatSyn`, which uses
 `TypeRep.pprTheta` to print both contexts:

 {{{
 pprPatSyn :: PatSyn -> SDoc
 pprPatSyn patSyn
   = pprPatSynSig ident is_bidir args (pprTypeForUser rhs_ty) prov req
   where
     ident = patSynId patSyn
     is_bidir = isJust $ patSynWrapper patSyn

     args = fmap pprParendType (patSynTyDetails patSyn)
     prov = pprThetaOpt prov_theta
     req = pprThetaOpt req_theta

     pprThetaOpt [] = Nothing
     pprThetaOpt theta = Just $ pprTheta theta

     (_univ_tvs, _ex_tvs, (prov_theta, req_theta)) = patSynSig patSyn
     rhs_ty = patSynType patSyn
 }}}

 So it seems to me that the problem is `pprTheta` pretty-printing the
 context constraint-by-constraint, without any regard to possible name
 clashes between mentioned type variables.

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


More information about the ghc-tickets mailing list