Skip to content

GHC panic when deriving Functor on a Fixed type

Building the following

{-# LANGUAGE DeriveFunctor#-}
module Main where 

data Event a b = Event a deriving (Functor)

newtype F f = F (f (F f))  

data EventF a = EventF (F (Event a)) deriving (Functor)

results in

Main.hs:7:48:ghc: panic! (the 'impossible' happened)
  (GHC version 7.8.2 for x86_64-unknown-linux):
	Prelude.(!!): index too large

I am not sure if the above code should actually compile but it probably shouldn't panic.

Trac metadata
Trac field Value
Version 7.8.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information