-
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.
Adapt to DLamCasesE in th-desugar-1.18
This patch bumps the pinned `th-desugar` commit to bring in the changes from goldfirere/th-desugar#218, which replaces `DLamE` and `DCaseE` in favor of `DLamCasesE`. Quite happily, this actually _simplifies_ how singling works in `singletons-th`. Previously, we went through great efforts to annotate promoted `case` expressions with their overall return type, as described in `Note [Annotate case return type]` and `Note [The id hack; or, how singletons-th learned to stop worrying and avoid kind generalization]` in `D.S.TH.Single`. After this patch, however, all `case` expressions are desugared to `\cases` expressions, and because we already annotate singled `\cases` expressions (by generating code like `singFun1 @LamCasesSym0 (\cases ...)`), we no longer need to use the tricks describes in those two Notes. Hooray! One interesting knock-on effect of these simplifications is that given code like this: ```hs map (\x -> ()) xs -- Note that `x` is unused ``` `singletons-th` would previously generate code that looked like this: ```hs sMap (singFun1 @LamdaSym0 (\sX -> case sX of (_ :: Sing x) -> STuple0)) sXs ``` Unlike the original code, this singled code would compile without warnings. This is because `sX` is "used" in the sense that it is passed to a `case` expression. It's a very silly `case` expression, as it doesn't do anything meaningful with `sX`, but it still technically counts as a use. Now that `singletons-th` uses a `\cases`-based approach to singling, however, the singled code will instead look like this: ```hs sMap (singFun1 @LamCasesSym0 (\cases (sX :: Sing x) -> STuple0)) sXs ``` This time, GHC _does_ recognize that `sX` is unused and emits a warning. This actually affects the way that `singletons-th` generates code for derived `Functor` and `Foldable` instances, so I needed to generate wildcard patterns instead of variable patterns in certain parts of `D.S.TH.Promote.Deriving.{Functor,Foldable}`. I have also mentioned the possibility of `singletons-th` generating more warnings in the `CHANGELOG`.
- Loading branch information
1 parent
a351105
commit 2107048
Showing
79 changed files
with
3,145 additions
and
2,928 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
1,417 changes: 709 additions & 708 deletions
1,417
singletons-base/tests/compile-and-dump/GradingClient/Database.golden
Large diffs are not rendered by default.
Oops, something went wrong.
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
Oops, something went wrong.