Skip to content

ghc panic in deriving Generic1 on Array#

Compiling the following code

{-# Language DeriveGeneric, MagicHash #-}

module Test where

import GHC.Generics
import GHC.Prim

data Array a = Array (Array# a)
newtype Vec a = MkVec {unVec :: Array a} deriving Generic1

causes panic:

[1 of 1] Compiling Test             ( Test.hs, Test.o )
ghc: panic! (the 'impossible' happened)
  (GHC version 7.6.3 for x86_64-unknown-linux):
	No match in record selector tyConTyVars

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

some comments from IRC:

<monoidal> with deriving Generic1 we get "Can't make a derived instance of `Generic1 Array': Array must not have unlifted or polymorphic arguments" - so it seems the check is not done recursively on used types <monoidal> * deriving Generic1 on Array

Trac metadata
Trac field Value
Version 7.6.3
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