-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve formatting of operator chains #830
Conversation
6f93427
to
200b651
Compare
When we have something like this: a =
1 + 2 + do
3 Should it stay as it is, or because the layout of the whole tree is multiline, should it be formatted to a =
1
+ 2
+ do
3 ? |
I would say it should stay as is, it is also the status quo. |
fe2363e
to
47c896f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
About examples where operator fixities cannot be ordered properly:
At the moment, with the non-configurable context-unaware "default" fixity map, we loose a lot of information about operators because of conflicting definitions. However, in a few days, I will improve the fixity map construction, by allowing
- user custom fixity declarations
- package detection from
.cabal
files - manual package selection
- and more...
which should give way better results requiring little to no explicit configuration.
The fixity map generation will also be rewritten in Haskell.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making such wonderful progress on this! I did the first pass and left some comments. I did not look at the implementation yet. At this point we want to make sure that the behavior is right. Once we are happy with that we can focus more on how this is implemented.
data/examples/declaration/value/function/operator-chains-out.hs
Outdated
Show resolved
Hide resolved
data/examples/declaration/value/function/operator-chains-out.hs
Outdated
Show resolved
Hide resolved
data/examples/declaration/value/function/operator-chains-out.hs
Outdated
Show resolved
Hide resolved
data/examples/declaration/value/function/operator-chains-out.hs
Outdated
Show resolved
Hide resolved
Also please note that we have merged #779 and this PR needs to be rebased on master. |
I think we should incorporate your ideas from the #832 in this PR. In particular:
|
I'm currently working on
|
0575795
to
95db2c6
Compare
e6fc8e3
to
df8f3a5
Compare
When trying a full nix-build, I encounter an error for the weeder target:
|
|
We finally have a version that passes all tests (thanks again @amesgen)! But there is still some work to do: TODO list:
|
df8f3a5
to
af9f7e4
Compare
Do you mean the ones in |
I enabled by default the autodetection of cabal dependencies to build the fixity map. If a cabal file is not found, a warning is emitted (in the same way How do you think we can improve this? |
One possible thing would be to try (if necessary) to find the .cabal files for all input files in the beginning, so warnings would only appear once (and all in one place), and the .cabal files would also only be parsed once (and again and again not for every file formatted, even though I don't think that this is very relevant for performance). While I don't think it is hard to do, it might require quite some refactoring, so I would suggest to leave it as is for now? |
Also, the CI still fails, but I don't know why -_- |
This is due to weird cabal behavior in multi package projects (it tries to resolve dependencies for packages it does not build). You can fix this by adding these two lines to the extract-hoogle .cabal file: ormolu/ormolu-live/ormolu-live.cabal Lines 34 to 35 in 3781d37
|
What would I do without you 😅 |
af9f7e4
to
d99998f
Compare
Now that |
WIP list of librairies shipped with GHC: https://docs.google.com/spreadsheets/d/1VO_FYsCVOgdfA5b3cJnPKq4IiCBKcW1D0ZoNyt-1_uA/edit?usp=sharing |
I just finished most of my assigned tasks (see d6fb306a41cb75ec18995eec443b233baaaff72c ); but I have a few questions:
Also, I think that I will have time to implement the "only use |
I did this in |
@tbagrel1 Thanks, I'll review your work later this week.
Not at the moment. I'll need to find time to look in more detail at that file anyway, which make cause it to change :)
Let's wait till we simplify the situation with trees.
I like to control JSON instances manually because I'm not always happy with auto-generated instances. Let's keep the manual definitions for now.
Let's not do this in this branch, instead let's take it from @amesgen 's branch when it is ready.
Feel free to attempt this if you have time. Like we discussed last week, the idea would be to get rid of |
Here are the benchmarks for fixity parsing at compile time: https://gist.github.com/amesgen/64e86711d21fb7e2c4fa5b597438a349 |
Note to myself: maybe we can get rid of the |
Another round of questions:
|
I think we can rename
If this is going to require an extra function that strips
I'd say let's not do this because this is not how Haskellers write code. For example here type PermuteRef =
"a"
:> ( "b" :> "c" :> End
:<|> "c" :> "b" :> End
)
:<|> "b"
:> ( "a" :> "c" :> End
:<|> "c" :> "a" :> End
) No one would actually indent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did another pass on every changed file, and I added a few questions along the way
7934fd1
to
82638bc
Compare
17784e3
to
f9e1660
Compare
I played with profiling today a little bit and it looks like if we delay construction of |
Who is/will be working on this? Should I take care of it? |
I have finished reviewing the PR. There are two things that we still need to address before we merge it:
Other than that, it looks really good. Great job @tbagrel1 ! |
4aa9bbd
to
469e7b9
Compare
I think that we also need to fix this before merging: #845 (comment) |
See the changelog for details. Co-authored-by: Alexander Esgen <alexander.esgen@tweag.io> Co-authored-by: Mark Karpov <mark.karpov@tweag.io>
313c39c
to
c57544b
Compare
@tbagrel1 Let's do it in a separate PR. I'm going to merge this once it is green. |
Close #826, close #785, close #690, close #825.