| 1 | {-# OPTIONS_GHC -XTypeFamilies #-} |
|---|
| 2 | module PanicRepro where |
|---|
| 3 | |
|---|
| 4 | -- Set up a type class with an associated type |
|---|
| 5 | |
|---|
| 6 | class Config s where type T s |
|---|
| 7 | |
|---|
| 8 | data X = UnusedXConstructor |
|---|
| 9 | |
|---|
| 10 | instance Config X where type T X = String |
|---|
| 11 | |
|---|
| 12 | -- Define two data constructors |
|---|
| 13 | |
|---|
| 14 | data Container s = Container (T s) |
|---|
| 15 | |
|---|
| 16 | data Action a = Action (IO a) |
|---|
| 17 | |
|---|
| 18 | -- Cause a compiler panic |
|---|
| 19 | |
|---|
| 20 | foo :: Action (Container X) |
|---|
| 21 | foo = |
|---|
| 22 | let f _ = -- Note the constraint (String ~ T X) in definition of g. |
|---|
| 23 | let g = return (Container "") |
|---|
| 24 | in Action g |
|---|
| 25 | in f () |
|---|
| 26 | |
|---|
| 27 | |
|---|