#1754: Border case type families/type equality coercions cause the impossible to
happen
-----------------------+----------------------------------------------------
  Reporter:  guest     |          Owner:                               
      Type:  bug       |         Status:  new                          
  Priority:  normal    |      Milestone:                               
 Component:  Compiler  |        Version:  6.8                          
  Severity:  minor     |       Keywords:  type family equality coercion
Difficulty:  Unknown   |             Os:  Linux                        
  Testcase:            |   Architecture:  Unknown                      
-----------------------+----------------------------------------------------
 A few border case problems with type equality coercions with type
 variables only occurring in the constraints part of the type. The code
 says it all.

 {{{
 {-# LANGUAGE TypeFamilies #-}
 module Weird where

 {- Compiles fine, but in GHCi:
 Prelude Weird> :t x
 *** Exception: No match in record selector Var.tcTyVarDetails
 -}
 x :: (a ~ b, Num b) => b
 x = undefined

 {- Same in GHCi, but when compiling:
 % /tmp/ghc-6.8/bin/ghc --make Weird.hs
 [1 of 1] Compiling Weird            ( Weird.hs, Weird.o )
 ghc-6.8.0.20071002: panic! (the 'impossible' happened)
   (GHC version 6.8.0.20071002 for i386-unknown-linux):
           initC: srt_lbl

 *Weird> plus 0 0
 ghc-6.8.0.20071002: panic! (the 'impossible' happened)
   (GHC version 6.8.0.20071002 for i386-unknown-linux):
           nameModule $dNum{v arP}
 -}
 plus    :: (a ~ b, b ~ c, c ~ d, Num b) => b -> c -> d
 plus x y = x + y

 {- This one only works when plus is commented out, otherwise:
 *Weird> y
 ghc-6.8.0.20071002: panic! (the 'impossible' happened)
   (GHC version 6.8.0.20071002 for i386-unknown-linux):
           nameModule $dNum{v arY}
 -}
 y :: (a ~ a) => ()
 y = ()
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1754>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to