Sort constraints in contexts#433
Merged
brandonchinn178 merged 1 commit intofourmolu:mainfrom Oct 7, 2024
Merged
Conversation
|
👋 @michaelpj Reviewer: Please verify the following things have been done, if applicable.
|
ca9a9e8 to
9aeb2b3
Compare
Collaborator
brandonchinn178
left a comment
There was a problem hiding this comment.
showOutputable is probably fine as a first pass
This adds some simple sorting of constraints. There are a few potential deficiencies: 1. It doesn't sort nested constraint tuples. We could solve this by carrying around some information about whether we are in a constraint context in `p_hsType`, but that seeemed moderately disruptive. 2. It doesn't handle constraint tuple synonyms. I think this is unavoidable since we can't know they're constraint tuples without type information. 3. The sorting is very crude, just sorting on the `Outputable` representation of the type. I think this will more-or-less doe what people expect, but perhaps it's too expensive? Fixes fourmolu#247
9aeb2b3 to
403dd7d
Compare
brandonchinn178
approved these changes
Oct 7, 2024
netbsd-srcmastr
pushed a commit
to NetBSD/pkgsrc
that referenced
this pull request
Jan 31, 2025
## Fourmolu 0.17.0.0 * Add new `import-grouping` option to group imports with grouping rules specified in configuration ([#403](fourmolu/fourmolu#403)) * Add new `sort-constraints` option to sort constraints alphabetically ([#433](fourmolu/fourmolu#433)) * Add new `sort-derived-classes` option to sort classes in deriving clauses ([#434](fourmolu/fourmolu#434)) * Add new `sort-derived-clauses` option to sort classes deriving clauses ([#434](fourmolu/fourmolu#434)) * Add new `trailing-section-operators` option to disable trailing "section" operators (those that are `infixr 0`, such as `$`) ([#444](fourmolu/fourmolu#444)) * Fix issue where `single-constraint-parens: never` would drop parentheses around implicit parameters ([#446](fourmolu/fourmolu#446)) * Fix indentation for parenthesized expressions that start off the indentation column ([#428](fourmolu/fourmolu#428)) * Allow multiline comments in indented contexts ([#65](fourmolu/fourmolu#65)) ## Fourmolu 0.16.2.0 ### Upstream changes: #### Ormolu 0.7.7.0 * Use single-line layout for parens around single-line content. [Issue 1120](tweag/ormolu#1120). * Allow function arguments to be on the same line even if the full type (with constraints and foralls) are on multiple lines. [PR 1125](tweag/ormolu#1125). ## Fourmolu 0.16.1.0 ### Upstream changes: #### Ormolu 0.7.6.0 * Fix Haddock comments on infix constructors [Issue 758](tweag/ormolu#758). * Don't require a trailing newline in `.ormolu` files. [Issue 1122](tweag/ormolu#1122). * Remove unnecessary indentation from list comprehensions. [Issue 966](tweag/ormolu#966). ## Fourmolu 0.16.0.0 * Allow specifying path to configuration file with `--config` ([#396](fourmolu/fourmolu#396)) ### Upstream changes: #### Ormolu 0.7.5.0 * Switched to `ghc-lib-parser-9.10`, with the following new syntactic features/behaviors: * GHC proposal [#575](https://github.com/ghc-proposals/ghc-proposals/blob/10290a668608d608c3f6c6010be265cf7a02e1fc/proposals/0575-deprecated-instances.rst): deprecated instances. * GHC proposal [#281](https://github.com/ghc-proposals/ghc-proposals/blob/10290a668608d608c3f6c6010be265cf7a02e1fc/proposals/0281-visible-forall.rst): visible forall in types of terms. Enabled by `RequiredTypeArguments` (enabled by default). * `LinearTypes`: `let` and `where` bindings can now be linear, in particular have multiplicity annotations. * Using `forall` as an identifier is now a parse error. * GHC proposal [#65](https://github.com/ghc-proposals/ghc-proposals/blob/10290a668608d608c3f6c6010be265cf7a02e1fc/proposals/0065-type-infix.rst): namespacing fixity declarations for type names and WARNING/DEPRECATED pragmas. * `TypeAbstractions` now supports `@`-binders in lambdas and function equations. * Support for the `GHC2024` language. * Updated to `Cabal-syntax-3.12`.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 adds some simple sorting of constraints. There are a few potential deficiencies:
p_hsType, but that seeemed moderately disruptive.Outputablerepresentation of the type. I think this will more-or-less doe what people expect, but perhaps it's too expensive?Fixes #427