#7391: "The 'impossible' happened" trying to derive Binary for a data instance
 Reporter:  ydewit              |          Owner:          
     Type:  bug                 |         Status:  new     
 Priority:  normal              |      Component:  Compiler
  Version:  7.4.1               |       Keywords:          
       Os:  MacOS X             |   Architecture:  x86     
  Failure:  Compile-time crash  |       Testcase:          
Blockedby:                      |       Blocking:          
  Related:                      |  
 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

Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7391>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

Glasgow-haskell-bugs mailing list

Reply via email to