Opened 3 years ago

Last modified 3 months ago

#5630 new bug

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@…, mail@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Compile-time crash Difficulty: Unknown
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 (9)

comment:1 Changed 3 years 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

comment:2 Changed 3 years 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

comment:3 Changed 3 years ago by igloo

  • Milestone set to 7.6.1

comment:4 Changed 3 years ago by dterei

  • Cc dterei added

comment:5 Changed 3 years ago by dterei

  • Architecture changed from x86_64 (amd64) to Unknown/Multiple
  • Operating System changed from Windows to Unknown/Multiple

comment:6 Changed 2 years ago by Eventh

  • Cc eventh@… added

comment:7 Changed 22 months ago by igloo

  • Milestone changed from 7.6.1 to 7.6.2

comment:8 Changed 13 months ago by igloo

  • Difficulty set to Unknown

See also #7713, #8001.

comment:9 Changed 3 months ago by kosmikus

  • Cc mail@… added
Note: See TracTickets for help on using tickets.