[GHC] #8543: `Coercible` ought to work for recursive newtypes

GHC ghc-devs at haskell.org
Wed Nov 20 08:39:12 UTC 2013


#8543: `Coercible` ought to work for recursive newtypes
-------------------------------------------+-------------------------------
       Reporter:  nomeata                  |             Owner:  nomeata
           Type:  task                     |            Status:  new
       Priority:  normal                   |         Milestone:
      Component:  Compiler (Type checker)  |           Version:  7.6.3
       Keywords:                           |  Operating System:
   Architecture:  Unknown/Multiple         |  Unknown/Multiple
     Difficulty:  Unknown                  |   Type of failure:
     Blocked By:                           |  None/Unknown
Related Tickets:  #8503                    |         Test Case:
                                           |          Blocking:
-------------------------------------------+-------------------------------
 At least on a best-effort basis.

 The approach (developed by SPJ and me) is to

 A) Add a feature to the constraint solver to prevent recursive
 dictionaries for specially marked instances (for now only used for
 `Coercible`). Rationale: Such dictionaries (which are fine for most
 classes like `Show`) would make `coerce` diverge. Implementation: Use the
 depth counter and do not use lower depths to solver constraints with a
 higher depth. This is of course a very conservative approximation, but
 should be sufficient.

 B) Use the regular constraint depth bound to prevent looping at compile
 time. In order for that to be more useful, count constraint solving and
 type function resolving separately.

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


More information about the ghc-tickets mailing list