#11399 closed bug (fixed)

Ill-kinded instance head involving -XTypeInType can invoke GHC panic

Reported by: RyanGlScott Owned by: goldfire
Priority: highest Milestone: 8.0.1
Component: Compiler (Type checker) Version: 8.1
Keywords: TypeInType Cc: goldfire, ekmett
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Compile-time crash Test Case: polykinds/T11399
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


This code:

{-# LANGUAGE FlexibleInstances, TypeInType #-}
module FvProvFallsIntoAHole where

import Data.Kind

newtype UhOh (k :: * -> *) (a :: k *) = UhOh (k *)
instance Functor k => Functor (UhOh k) where

produces this GHC panic:

$ /opt/ghc/head/bin/ghc FvProvFallsIntoAHole.hs
[1 of 1] Compiling FvProvFallsIntoAHole ( FvProvFallsIntoAHole.hs, FvProvFallsIntoAHole.o )
ghc: panic! (the 'impossible' happened)
  (GHC version 8.1.20160108 for x86_64-unknown-linux):
        fvProv falls into a hole {aq6}

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

Change History (6)

comment:1 Changed 18 months ago by ekmett

You don't even need -XTypeInType.

I had this bite me earlier when I accidentally gave one too many type parameters to K1.

class GEq1 t where
  gliftEq :: (a -> b -> Bool) -> t a -> t b -> Bool

instance Eq c => GEq1 (K1 i c) where gliftEq _ (K1 c) (K1 d) = c == d

If you replace the instance with

instance Eq c => GEq1 (K1 i c oops) where gliftEq _ (K1 c) (K1 d) = c == d

You get the same fpProv falls into a hole error.

comment:2 Changed 18 months ago by ekmett

Cc: ekmett added
Milestone: 8.0.1
Priority: normalhighest

Upgrading to highest as this can affect normal users, not just those on the bleeding edge.

comment:3 Changed 18 months ago by simonpj

Owner: set to goldfire

comment:4 Changed 18 months ago by Simon Peyton Jones <simonpj@…>

In b565830d/ghc:

Wrap solveEqualities in checkNoErrs

This simple change fixes Trac #11563, #11520, #11516, #11399.
See esp the comments in #11520.

See Note [Fail fast on kind errors] in TcSimplify

Merge to 8.0 branch

comment:5 Changed 18 months ago by simonpj

Status: newmerge
Test Case: polykinds/T11399

Ha! One fix closes four tickets. Merge to 8.0 branch.

comment:6 Changed 18 months ago by bgamari

Resolution: fixed
Status: mergeclosed
Note: See TracTickets for help on using tickets.