GHC: Ticket #3101: GHC crashes on synonym family in a rank-n type
http://ghc.haskell.org/trac/ghc/ticket/3101
<pre class="wiki">{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE RankNTypes #-}
module Boom where
type family F a :: *
data Boom = Boom (forall a. F a)
deriving Show
</pre><p>
When loading the above compilation unit into GHCi, it crashes with:
</p>
<pre class="wiki">ghc: panic! (the 'impossible' happened)
(GHC version 6.10.1 for i386-apple-darwin):
TcTyFuns.flattenType: synonym family in a rank-n type
</pre>en-usGHChttp://ghc.haskell.org/trac/ghc/chrome/site/ghc_logo.png
http://ghc.haskell.org/trac/ghc/ticket/3101
Trac 1.2MartijnVanSteenbergenSun, 15 Mar 2009 16:58:25 GMT
http://ghc.haskell.org/trac/ghc/ticket/3101#comment:1
http://ghc.haskell.org/trac/ghc/ticket/3101#comment:1
<p>
I have to add that while the above snippet makes no sense as a Haskell program, I was in fact doing something along the following lines, which does make sense:
</p>
<pre class="wiki">type family F a :: * -> *
data Boom a = Boom (forall b. F a b)
deriving Show
</pre><p>
Also note that there is no problem when "deriving Show" is left away.
</p>
TicketsimonpjMon, 16 Mar 2009 15:27:17 GMTdifficulty set
http://ghc.haskell.org/trac/ghc/ticket/3101#comment:2
http://ghc.haskell.org/trac/ghc/ticket/3101#comment:2
<ul>
<li><strong>difficulty</strong>
set to <em>Unknown</em>
</li>
</ul>
<p>
I don't think 'deriving' supports rank-N types. (What would you want it to show?)
</p>
<p>
Thanks for he report; I'll add a test so that it's rejected in a more civilised way.
</p>
<p>
Simon
</p>
TicketsimonpjMon, 16 Mar 2009 17:17:49 GMTtype changed; testcase, owner set
http://ghc.haskell.org/trac/ghc/ticket/3101#comment:3
http://ghc.haskell.org/trac/ghc/ticket/3101#comment:3
<ul>
<li><strong>testcase</strong>
set to <em>deriving/should_fail/T3101</em>
</li>
<li><strong>owner</strong>
set to <em>igloo</em>
</li>
<li><strong>type</strong>
changed from <em>bug</em> to <em>merge</em>
</li>
</ul>
<p>
Fixed by
</p>
<pre class="wiki">Mon Mar 16 09:45:02 PDT 2009 simonpj@microsoft.com
* Reject foralls in constructor args in 'deriving', except for Functor etc
</pre><p>
There's a bit of refactoring in here to do with deriving <code>Functor</code>, so this patch won't merge into 6.10.2 trivially, though it would be easy to smooth over the bumps. It's not a big deal either way.
</p>
<p>
Simon
</p>
TicketiglooWed, 18 Mar 2009 22:40:39 GMTstatus changed; resolution set
http://ghc.haskell.org/trac/ghc/ticket/3101#comment:4
http://ghc.haskell.org/trac/ghc/ticket/3101#comment:4
<ul>
<li><strong>status</strong>
changed from <em>new</em> to <em>closed</em>
</li>
<li><strong>resolution</strong>
set to <em>fixed</em>
</li>
</ul>
<p>
Merged.
</p>
Ticket