Make singling preserve type variable order in type signatures #408
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch tweaks
singType
(and its sister functionsingCtor
) to produce type signatures that preserve the order in which type variables appear. For instance, if one writes this:Then its singled counterpart will now quantify
b
anda
in the same order:This is important if one wants to combine
sConst2
with visible type applications, as this means that the meaning of@T1 @T2
inconst @T1 @T2
will be preserved when one writessConst2 @T1 @T2
. This also paves the way for #378, which seeks to fully support promoting/singling type applications in the TH machinery.Most of the interesting parts of this patch are described in
Note [Preserve the order of type variables during singling]
inD.S.Single.Type
, so start that is a good starting point when looking at this patch for the first time.Fixes chunk (1) in #378 (comment), but there are still other parts of #378 that remain to be fixed.