| 1 | {-# LANGUAGE TypeFamilies #-} |
|---|
| 2 | module Weird where |
|---|
| 3 | |
|---|
| 4 | {- Compiles fine, but in GHCi: |
|---|
| 5 | Prelude Weird> :t x |
|---|
| 6 | *** Exception: No match in record selector Var.tcTyVarDetails |
|---|
| 7 | -} |
|---|
| 8 | x :: (a ~ b, Num b) => b |
|---|
| 9 | x = 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 ) |
|---|
| 14 | ghc-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 |
|---|
| 19 | ghc-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 | -} |
|---|
| 23 | plus :: (a ~ b, b ~ c, c ~ d, Num b) => b -> c -> d |
|---|
| 24 | plus x y = x + y |
|---|
| 25 | |
|---|
| 26 | {- This one only works when plus is commented out, otherwise: |
|---|
| 27 | *Weird> y |
|---|
| 28 | ghc-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 | -} |
|---|
| 32 | y :: (a ~ a) => () |
|---|
| 33 | y = () |
|---|