Ticket #5630 (new bug)

Opened 19 months ago

Last modified 8 months ago

External Core needs love

Reported by: quux Owned by:
Priority: normal Milestone: 7.6.2
Component: Compiler Version: 7.2.1
Keywords: Cc: dterei, eventh@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Compile-time crash Difficulty:
Test Case: Blocked By:
Blocking: Related Tickets:

Description

{-# LANGUAGE GADTs #-}

data T a b where
  T1 :: a -> b -> T [a] (a,b)
  
main = putStrLn ":("

and then "ghc this.hs -fext-core" results in

>ghc core-sandbox.hs -fext-core
ghc core-sandbox.hs -fext-core
[1 of 1] Compiling Main             ( core-sandbox.hs, core-sandbox.o )
ghc: panic! (the 'impossible' happened)
  (GHC version 7.2.1 for i386-unknown-mingw32):
	make_exp (App _ (Coercion _))

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

Change History

Changed 18 months ago by simonpj

  • summary changed from panic! (the 'impossible' happened) with GADT with -fext-core to External Core needs love

External Core is defined by a data type in coreSyn/ExternalCore.lhs. This data type has received No Love for years. As a result, it is lagging way behind Core, as is External Core's concrete syntax. For example it does not accommodate GADTs at all, I think. In this particular ticket, we are trying to convert a Coercion from Core to ExtenalCore.Exp, but there are no coercions (yet) in Exp.

In short, External Core needs some love and attention.

(I suspect it's ended up in this state because most people are using the GHC API instead, but the idea of giving Core a proper, printable external realisation remains a good one..)

If anyone feels able to draft it into the 21st century I'd be happy to advise. For what it's worth, I think that a promising approach might be to abolish the ExternalCore data types in favour of those in IfaceSyn, which serve a very similar purpose. The IfaceSyn types didn't exist when External Core was first implemented, but they very much do now, and they *cannot* lag.

So I suggest that we abandon ExtCore as it is, and instead write a printer and parser for IfaceSyn. But it needs a volunteer.

Simon

Changed 18 months ago by tim

The reason for having the ExternalCore data types is that External Core has a semantics (through the ext-core typechecker and interpreter), and I'm not sure whether IfaceSyn? does (though I'm not really familiar with it). (Of course, the semantics probably doesn't reflect GADTs right now...)

I'm not really sure I'm up for giving ext-core more love at this point, but I wanted to recommend some caution...

Tim

Changed 18 months ago by igloo

  • milestone set to 7.6.1

Changed 18 months ago by dterei

  • cc dterei added

Changed 18 months ago by dterei

  • os changed from Windows to Unknown/Multiple
  • architecture changed from x86_64 (amd64) to Unknown/Multiple

Changed 13 months ago by Eventh

  • cc eventh@… added

Changed 8 months ago by igloo

  • milestone changed from 7.6.1 to 7.6.2
Note: See TracTickets for help on using tickets.