-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove wrinkle 2 (and revise wrinkle 3) of Note [Preserve the order o…
…f type variables during singling] Now that goldfirere/th-desugar#199 has been fixed, `singletons-th` can always guarantee that the type variable specificities that it reifies will be accurate. As such, all of wrinkle 2 in `Note [Preserve the order of type variables during singling]` is moot, so this PR deletes this wrinkle entirely. Wrinkle 3 has now been renamed to wrinkle 2. What was formerly known as wrinkle 3 is mostly kept the same, although I have expanded upon it a little to clarify what we single data constructors such as `Nothing :: forall a. Maybe a` to `SNothing :: forall a. SMaybe (Nothing :: Maybe a)` rather than, say, `SNothing :: forall a. SMaybe (Nothing @A)`. For instance, imagine if `a` was inferred rather than specified! I have added a `T565` test case which ensures that `singletons-th` generates valid code for the case when a data constructor uses an inferred type variable binder. I have also added an addendum to the `README` noting that `singletons-th` does not currently support `AllowAmbiguousTypes` at all, which would be perhaps the one convincing argument in favor of using explicit kind applications when singling return types (rather than explicit return kinds). Fixes #565.
- Loading branch information
1 parent
b720f3c
commit a63cf05
Showing
11 changed files
with
101 additions
and
255 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
16 changes: 16 additions & 0 deletions
16
singletons-base/tests/compile-and-dump/Singletons/T565.golden
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,16 @@ | ||
Singletons/T565.hs:(0,0)-(0,0): Splicing declarations | ||
singletons [d| data C a where D :: forall {a}. C a |] | ||
======> | ||
data C a where D :: forall {a}. C a | ||
type DSym0 :: forall {a}. C a | ||
type family DSym0 :: C a where | ||
DSym0 = D | ||
data SC :: forall a. C a -> Type | ||
where SD :: forall {a}. SC (D :: C a) | ||
type instance Sing @(C a) = SC | ||
instance SingKind a => SingKind (C a) where | ||
type Demote (C a) = C (Demote a) | ||
fromSing SD = D | ||
toSing D = SomeSing SD | ||
instance SingI D where | ||
sing = SD |
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,8 @@ | ||
module T565 where | ||
|
||
import Data.Singletons.TH | ||
|
||
$(singletons [d| | ||
data C a where | ||
D :: forall {a}. C 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
Oops, something went wrong.