[GHC] #12885: "too many iterations" causes constraint solving issue.

GHC ghc-devs at haskell.org
Mon Nov 28 17:12:11 UTC 2016


#12885: "too many iterations" causes constraint solving issue.
-------------------------------------+-------------------------------------
        Reporter:  judahj            |                Owner:
            Type:  bug               |               Status:  merge
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.2-rc1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  GHC rejects       |  Unknown/Multiple
  valid program                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by simonpj):

 * status:  new => merge


Comment:

 Aha!  Happily, this patch (committed last week) fixes it
 {{{
 commit 0476a64e70c91b326b53db2fc55adbbaa8e5c270
 Author: Simon Peyton Jones <simonpj at microsoft.com>
 Date:   Tue Oct 25 15:22:17 2016 +0100

     Fix a bug in mk_superclasses_of

     This bug meant that we were less eager about expanding
     tuple superclasses than we should have been; i.e. we stopped
     too soon.  That's not fatal, beause we expand more superclasses
     later, but it's less efficient.
 }}}
 It's fine in HEAD.

 I suggest we just merge the patch across for 8.0.3.

 Here's a one-module test case
 {{{
 {-# LANGUAGE TypeFamilies, ConstraintKinds  #-}

 module Foo where

 import GHC.Exts

 f :: F [a] => a -> Bool
 f x = x == x

 type family F a :: Constraint
 type instance F [a] = (Show a, (Show a, (Show a, (Show a, (Show a,
                        Show a, (Show a, (Show a, (Show a, (Show a, Eq
 a)))))))))
 }}}
 The Given `F [a]` expands to the nested tuple, and the bug is that we were
 only expanding one level of the tuple at a time.

 I'll add this test to HEAD, for what it's worth.

 Thanks for identifying this!

 Simon

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


More information about the ghc-tickets mailing list