Ticket #7070 (closed bug: fixed)

Opened 11 months ago

Last modified 10 months ago

DataKinds and package boundaries: "the 'impossible' happened"

Reported by: aristidb Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.4.2
Keywords: Cc:
Operating System: Linux Architecture: x86_64 (amd64)
Type of failure: Compile-time crash Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description (last modified by simonpj) (diff)

I don't know what is going on there, so I can't really give much more information, sorry.

aristid@sigmoid:~/Code/aws/Examples$ ghc -package-conf ../dist/package.conf.inplace GetObject.hs 
[1 of 1] Compiling Main             ( GetObject.hs, GetObject.o )
ghc: panic! (the 'impossible' happened)
  (GHC version 7.4.2 for x86_64-unknown-linux):
	tyThingTyCon
    Data constructor `aws-0.7.0:Aws.Core.NormalQuery{d r2qt}'

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

Attachments

package.conf.inplace Download (3.6 KB) - added by aristidb 11 months ago.
GetObject.hs Download (0.9 KB) - added by aristidb 11 months ago.
data-kinds-haskell-bug.tgz Download (0.7 KB) - added by aristidb 11 months ago.
Minimal test example

Change History

Changed 11 months ago by aristidb

Changed 11 months ago by aristidb

Changed 11 months ago by aristidb

I forgot to enclose the error in a code block...

aristid@sigmoid:~/Code/aws/Examples$ ghc -package-conf ../dist/package.conf.inplace GetObject.hs 
[1 of 1] Compiling Main             ( GetObject.hs, GetObject.o )
ghc: panic! (the 'impossible' happened)
  (GHC version 7.4.2 for x86_64-unknown-linux):
	tyThingTyCon
    Data constructor `aws-0.7.0:Aws.Core.NormalQuery{d r2qt}'

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

Changed 11 months ago by aristidb

So, while I still don't know what is going on, I think this might be related to usage of DataKinds?. I have tracked this down by trying to go back to a commit in my repository where this behavior does not happen, and it's just before I introduced some very simple code that uses DataKinds?. It might be the package boundary that is confusing GHC there?

Please tell me if there is other information that I can attach to help you. Maybe I can cook up a minimal test, but this is fairly hard when you don't know what is going on!

Changed 11 months ago by aristidb

So I succeeded at creating a minimal test example. It _is_ related to DataKinds?, and it's remarkable how little code is needed to trigger it. I'm going to attach it as a tarfile, and as a small Github repository for easier browsing:  https://github.com/aristidb/data-kinds-haskell-bug

Changed 11 months ago by aristidb

Minimal test example

Changed 11 months ago by aristidb

Note that there's a script trigger.sh that should trigger the bug. It does basically the same ghc -package-conf invocation as in the original unminimised example, and yields this output for me:

aristid@sigmoid:~/Code/data-kinds-haskell-bug$ ./trigger.sh 
Resolving dependencies...
Configuring data-kinds-haskell-bug-0.1...
Preprocessing library data-kinds-haskell-bug-0.1...
Building data-kinds-haskell-bug-0.1...
[1 of 1] Compiling IsThisTheBug     ( IsThisTheBug.hs, dist/build/IsThisTheBug.o )
Registering data-kinds-haskell-bug-0.1...
[1 of 1] Compiling Main             ( Importer.hs, Importer.o )
ghc: panic! (the 'impossible' happened)
  (GHC version 7.4.2 for x86_64-unknown-linux):
	tyThingTyCon
    Data constructor `data-kinds-haskell-bug-0.1:IsThisTheBug.KindConstructor1{d r2Q}'

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

(The fact that Trac doesn't allow editing comments makes it hard for me, because I always think of new stuff after I've already made the comment.)

Changed 11 months ago by aristidb

  • summary changed from "the 'impossible' happened" to DataKinds and package boundaries: "the 'impossible' happened"

Changed 10 months ago by simonpj

  • status changed from new to closed
  • difficulty set to Unknown
  • resolution set to fixed
  • description modified (diff)

Thanks. DataKinds is not an advertised feature of 7.4.2. I've tested your example with HEAD (which will become 7.6) and it's fine. Pending the release you can build from source, or grab a snapshot distribution.

(I won't add a regression test because it's a complicated one, and there are so many possible causes.)

Simon

Changed 10 months ago by aristidb

OK, I guess I need to implement the "ugly" solution to my problem that doesn't require DataKinds?. For an "unadvertised" feature, word spread pretty quickly, perhaps you should have include a few big red warning texts to tell people that it's considered highly experimental in 7.4.

I should note by the way that no problem was caused as long as the DataKinds? code was loaded as source modules, not as package modules. If that helps pin down a cause for a possible regression text.

Note: See TracTickets for help on using tickets.