Ticket #1754: Weird.hs

File Weird.hs, 0.9 KB (added by guest, 6 years ago)
Line 
1{-# LANGUAGE TypeFamilies #-}
2module Weird where
3
4{- Compiles fine, but in GHCi:
5Prelude Weird> :t x
6*** Exception: No match in record selector Var.tcTyVarDetails
7-}
8x :: (a ~ b, Num b) => b
9x = undefined
10
11{- Same in GHCi, but when compiling:
12% /tmp/ghc-6.8/bin/ghc --make Weird.hs
13[1 of 1] Compiling Weird            ( Weird.hs, Weird.o )
14ghc-6.8.0.20071002: panic! (the 'impossible' happened)
15  (GHC version 6.8.0.20071002 for i386-unknown-linux):
16          initC: srt_lbl
17
18*Weird> plus 0 0
19ghc-6.8.0.20071002: panic! (the 'impossible' happened)
20  (GHC version 6.8.0.20071002 for i386-unknown-linux):
21          nameModule $dNum{v arP}
22-}
23plus    :: (a ~ b, b ~ c, c ~ d, Num b) => b -> c -> d
24plus x y = x + y
25
26{- This one only works when plus is commented out, otherwise:
27*Weird> y
28ghc-6.8.0.20071002: panic! (the 'impossible' happened)
29  (GHC version 6.8.0.20071002 for i386-unknown-linux):
30          nameModule $dNum{v arY}
31-}
32y :: (a ~ a) => ()
33y = ()