-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle associated types properly in D.S.Promote.Defun (#418)
Associated type families were going through the same code path as top-level open type families during defunctionalization. But top-level open type families always default any type variable binders without explicit kinds to be of kind `Type`. This approach does not always work for associated type families, leading to the bug observed in #414. This fixes the issue by partitioning associated type families separately from other open type families in `D.S.Partition` and introducing a new `defunAssociatedTypeFamilies` function in `D.S.Promote.Defun` to handle them. I've also added some more comments in various places to make things a bit clearer. Fixes #414.
- Loading branch information
1 parent
499096a
commit 1e842fd
Showing
8 changed files
with
156 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
Singletons/T414.hs:(0,0)-(0,0): Splicing declarations | ||
singletons | ||
[d| class C1 (a :: Bool) where | ||
type T1 a b | ||
class C2 a where | ||
type T2 a b |] | ||
======> | ||
class C1 (a :: Bool) where | ||
type T1 a b | ||
class C2 a where | ||
type T2 a b | ||
type T1Sym2 (a0123456789876543210 :: Bool) (b0123456789876543210 :: GHC.Types.Type) = | ||
T1 a0123456789876543210 b0123456789876543210 | ||
instance SuppressUnusedWarnings (T1Sym1 a0123456789876543210) where | ||
suppressUnusedWarnings = snd (((,) T1Sym1KindInference) ()) | ||
data T1Sym1 (a0123456789876543210 :: Bool) :: (~>) GHC.Types.Type GHC.Types.Type | ||
where | ||
T1Sym1KindInference :: forall a0123456789876543210 | ||
b0123456789876543210 | ||
arg. SameKind (Apply (T1Sym1 a0123456789876543210) arg) (T1Sym2 a0123456789876543210 arg) => | ||
T1Sym1 a0123456789876543210 b0123456789876543210 | ||
type instance Apply (T1Sym1 a0123456789876543210) b0123456789876543210 = T1 a0123456789876543210 b0123456789876543210 | ||
instance SuppressUnusedWarnings T1Sym0 where | ||
suppressUnusedWarnings = snd (((,) T1Sym0KindInference) ()) | ||
data T1Sym0 :: (~>) Bool ((~>) GHC.Types.Type GHC.Types.Type) | ||
where | ||
T1Sym0KindInference :: forall a0123456789876543210 | ||
arg. SameKind (Apply T1Sym0 arg) (T1Sym1 arg) => | ||
T1Sym0 a0123456789876543210 | ||
type instance Apply T1Sym0 a0123456789876543210 = T1Sym1 a0123456789876543210 | ||
class PC1 (a :: Bool) | ||
type T2Sym2 a0123456789876543210 b0123456789876543210 = | ||
T2 a0123456789876543210 b0123456789876543210 | ||
instance SuppressUnusedWarnings (T2Sym1 a0123456789876543210) where | ||
suppressUnusedWarnings = snd (((,) T2Sym1KindInference) ()) | ||
data T2Sym1 a0123456789876543210 b0123456789876543210 | ||
where | ||
T2Sym1KindInference :: forall a0123456789876543210 | ||
b0123456789876543210 | ||
arg. SameKind (Apply (T2Sym1 a0123456789876543210) arg) (T2Sym2 a0123456789876543210 arg) => | ||
T2Sym1 a0123456789876543210 b0123456789876543210 | ||
type instance Apply (T2Sym1 a0123456789876543210) b0123456789876543210 = T2 a0123456789876543210 b0123456789876543210 | ||
instance SuppressUnusedWarnings T2Sym0 where | ||
suppressUnusedWarnings = snd (((,) T2Sym0KindInference) ()) | ||
data T2Sym0 a0123456789876543210 | ||
where | ||
T2Sym0KindInference :: forall a0123456789876543210 | ||
arg. SameKind (Apply T2Sym0 arg) (T2Sym1 arg) => | ||
T2Sym0 a0123456789876543210 | ||
type instance Apply T2Sym0 a0123456789876543210 = T2Sym1 a0123456789876543210 | ||
class PC2 a | ||
class SC1 (a :: Bool) | ||
class SC2 a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module T414 where | ||
|
||
import Data.Singletons.TH | ||
|
||
$(singletons [d| | ||
class C1 (a :: Bool) where | ||
type T1 a b | ||
|
||
class C2 a where | ||
type T2 a b | ||
|]) |