[GHC] #13032: Redundant forcing of Given dictionaries

GHC ghc-devs at haskell.org
Fri Dec 23 15:13:42 UTC 2016


#13032: Redundant forcing of Given dictionaries
-------------------------------------+-------------------------------------
           Reporter:  simonpj        |             Owner:
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.0.1
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 If you look at the test case for #13025 you'll see code like
 {{{
 f :: (a~~b) => a -> b -> Bool
 f d x y  = case HEq_sc d of (cobox :: a ~# b) ->
            True
 }}}
 From the Given dictionary `(a~~b)`, the contraint solver generates a given
 binding, just in case
 {{{
   (cobox :: a~# b) = HEq_sc d
 }}}
 But because `cobox` is a ''coercion'' we evaluate this binding strictly,
 and so the desugarer produces the case expression above.  Most redundant
 Given bindings are let-bound and hence discarded quickly by the occurrence
 analyser, but GHC doesn't discard cases (termination worries).

 So the task here is to remove the redundant Given in some way.  (Of
 course, if the equality is actually used, we need to keep it.)

 NB: See `Note [The equality types story]` in `TysPrim` for the meanagerie
 of equality types.

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


More information about the ghc-tickets mailing list