"The 'impossible' happened" trying to derive Binary for a data instance
I was trying to automatically derive Binary for a data instance (data family) and was trying to work around the fact that "derive makeBinary" expects a Name and not an expression by using a type alias. This is when I got the GHC compilation error.
This is a simple test case:
import Data.Binary (Binary (..), putWord8, getWord8)
import Data.DeriveTH
newtype Id a = Id String deriving Show
data family Cmd a
data instance Cmd (Id AData)
= A1
| A2
type ADataCmd = Cmd (Id AData)
$( derive makeBinary ''ADataCmd)
And here the compilation error:
ghc: panic! (the 'impossible' happened)
(GHC version 7.4.1 for i386-apple-darwin):
Could not convert Dec to Decl
Trac metadata
Trac field | Value |
---|---|
Version | 7.4.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |