-
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.
Simplify TH defunctionalization machinery slightly
The inner loop of the `defunctionalize` function was passing around a higher-order function to compute the right-hand sides of `Apply` instances. But this is really more complicated than it needs to be, as it is quite feasible to determine what the right-hand side of any `Apply` instance will be without keeping track of this extra state. The general formula is simply: ```hs type instnce Apply (DSym{n} a{1} ... a{n}) a_{n+1} = DSym{n+1} a{1} ... a{n} a{n+1} ``` Where `n` is the number of matchable arguments for the defunctionalization symbol being generated. Previously, `defunctionalize` had a special case for when `n+1` equals the number of arguments the original type `D` accepts, which caused it to generate `D a{1} ... a{n} a{n+1}` as the right-hand side. Due to the aforementioned simplification, it now generates `DSym{n+1} a{1} ... a{n} a{n+1}` instead, which causes quite a number of golden test files to change. As a result, this patch looks large, but the vast majority of the changes are simply the result of `D` changing to `DSym{n+1}`.
- Loading branch information
1 parent
dff1f74
commit 2ec1843
Showing
89 changed files
with
397 additions
and
400 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
Oops, something went wrong.