Opened 5 months ago

Last modified 5 months ago

#8550 new bug

GHC builds recursive coerctions when using recursive type families

Reported by: nomeata Owned by:
Priority: normal Milestone:
Component: Compiler (Type checker) Version:
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:



{-# LANGUAGE TypeFamilies, GADTs, UndecidableInstances #-}
type family F a
        type instance F () = F ()
        data A where
         A :: F () ~ () => A
        x :: A
        x = A

On GHC 7.6.3 it yields a context reduction stack overflow (despite F () ~ () being put into the “solved funeqs” list).

In HEAD, a recursive dictionary is built, but then detected:

[1 of 1] Compiling Foo              ( Foo.hs, Foo.o )
        ghc-stage2: panic! (the 'impossible' happened)
          (GHC version 7.7.20131108 for x86_64-unknown-linux):
        	Cycle in coercion bindings
            [[cobox_ayX{v} [lid]
                = CO main:Foo.TFCo:R:F(){tc rob}[0] ; cobox_ayZ{v} [lid],
              cobox_ayZ{v} [lid] = CO cobox_ayX{v} [lid] ; cobox_az0{v} [lid]]]
        Please report this as a GHC bug:

Either this panic needs to be turned into an error, or we need to prevent recursive dictionaries for when solving funeqs (similar to how we do it for Coercible).

Change History (6)

comment:1 Changed 5 months ago by nomeata

  • Version 7.6.3 deleted

comment:2 Changed 5 months ago by monoidal

Could you check whether it works now?

comment:3 Changed 5 months ago by nomeata

Yes, same thing. What would make you think it changed since two weeks ago?

comment:4 Changed 5 months ago by monoidal

Sorry, I couldn't reproduce; now I see the panic needs compiling with DEBUG.

comment:5 Changed 5 months ago by nomeata

Ah, ok. Did not try that. What happens when you actually run the code? I assume it will just loop...

comment:6 Changed 5 months ago by monoidal

Right. main = seq A (return ()) loops.

Note: See TracTickets for help on using tickets.