[GHC] #14111: strange error when using data families with levity polymorphism and unboxed sums and data families

GHC ghc-devs at haskell.org
Sat Mar 31 16:32:56 UTC 2018


#14111: strange error when using data families with levity polymorphism and unboxed
sums and data families
-------------------------------------+-------------------------------------
        Reporter:  carter            |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.1
      Resolution:                    |             Keywords:  TypeFamilies
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #14457            |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by goldfire):

 Bizarre. My line numbers from HEAD match exactly yours -- but in the
 `ConDeclH98` clause.

 And I'm stymied about the infinite loop on T13242a. Oh, wait. Maybe I'm
 not.

 Here is the problem case:

 {{{#!hs
 data T where
   A :: forall a. Eq a => a -> T
 }}}

 The problem is that `T` is knot-tied, because we're in the act of building
 it. So we can't then go and unify it. Instead, you should do the same
 basic thing as you're doing above, but to the ''arguments'' of the tycon,
 not the whole tyconapp itself. That is, use `tcSplitTyConApp` on the
 `res_tmpl` and the `res_ty'` and then unify the respective arguments. (You
 might have to explicitly deal with the possibility that the lists are of
 different length. I ''think'' lists of different lengths are definitely
 errors.)

 Upon further thought, this "unify the args" approach solves this
 particular case, but it won't solve all cases, because it's possible to
 mention knot-tied types in the arguments to a GADT result type. I don't
 know a way out, then, other than to wait until #13737 gets rid of the
 whole knot-tying business.

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


More information about the ghc-tickets mailing list