#7391: "The 'impossible' happened" trying to derive Binary for a data instance
---------------------------------+------------------------------------------
  Reporter:  ydewit              |          Owner:         
      Type:  bug                 |         Status:  closed 
  Priority:  normal              |      Milestone:         
 Component:  Compiler            |        Version:  7.4.1  
Resolution:  invalid             |       Keywords:         
        Os:  MacOS X             |   Architecture:  x86    
   Failure:  Compile-time crash  |     Difficulty:  Unknown
  Testcase:                      |      Blockedby:         
  Blocking:                      |        Related:         
---------------------------------+------------------------------------------
Changes (by simonpj):

 * cc: ndmitchell@… (added)
  * difficulty:  => Unknown
  * status:  new => closed
  * resolution:  => invalid


Comment:

 This is a bug in the `derive` package, not in GHC. The full message looks
 like this
 {{{
 T7391.hs:1:1:
     Exception when trying to run compile-time code:
       Could not convert Dec to Decl
 TySynD T7391.ADataCmd [] (AppT (ConT T7391.Cmd) (AppT (ConT T7391.Id)
 (ConT T7391.AData)))
 Language\Haskell\Convert.hs:(37,14)-(40,8): Non-exhaustive patterns in
 case

     Code: derive makeBinary ''ADataCmd
 }}}
 And indeed the `Convert` module of the `derive` package has this
 {{{
 instance Convert TH.Dec HS.Decl where
     conv x = case x of
         DataD cxt n vs con ds -> f DataType cxt n vs con ds
         NewtypeD cxt n vs con ds -> f NewType cxt n vs [con] ds
         where
             f t cxt n vs con ds = DataDecl sl t (c cxt) (c n) (c vs) (c
 con) []
 }}}
 Notice taht there are only two cases in the `case` expression. Your
 program uses a `data family` which is not dealt with by these two cases.

 Perhaps you need to talk to Neil Mitchell, who is the mainainer of
 `derive`.

 I'll close as invalid for now; please reopen if you think it's GHC's
 problem.

 Simon

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

_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to