1
1
mirror of https://github.com/google/ormolu.git synced 2024-11-23 14:16:24 +03:00
Commit Graph

11 Commits

Author SHA1 Message Date
Utku Demir
7268eb1e98 Handle operator chains better
I implemented a custom logic where we assign a score to every occurance of
an operator based on their location, and the average of that score determine
the fixity of the operator.

As you can imagine, the solution is a bit brittle; and it is easy to mislead
it if you knowingly craft an input, but it gave acceptable results for every
code snippet I found online. And since it returns the same AST no matter how
we infer the fixities, it is not the end of the world if we infer something
incorrectly.

The code is not really optimised, and I think it has quadratic time
complexity. Notably, we use opTreeLoc function quite often and it traverses
the whole tree every time. Memoizing that on the OpBranch constructor would
make formatting files with reeeally long operator chains a lot faster. We
can do this once we decide to optimize for speed.
2019-09-10 18:27:15 +02:00
mrkkrp
d4761bf425 Enable checking the ‘tls’ package on CI 2019-09-09 11:13:58 +02:00
mrkkrp
a3a93ebfef Refactor the comment rendering code and ‘newline’
This removes (or rather puts it to a lower level) logic around “modifying
newline” because it was very hard to reason about and almost blocked my work
on fixing issue #337.

I also dropped debugging output because it's too verbose and I'm not using
it anyway.

As part of these changes I also changed now the ‘newline’ combinator works.
Now, similar to ‘space’, the second ‘newline’ in a row just tells the
rendering engine to prefix next thing with a newline, using the ‘newline’
combinator more than twice in a row has no effect.

To take full advantage of the new feature I also went through the code and
simplified some logic around outputting exact amount of newlines because now
it's harder to get things wrong, so we can be less careful with counting
newlines.
2019-09-05 16:56:43 +02:00
Utku Demir
d900f4efaf Test a few Hackage packages on CI 2019-08-30 12:44:14 +02:00
mrkkrp
c0513b3024 Use GHC 8.6.5 2019-08-28 15:44:41 +02:00
mrkkrp
a3559a2a07 Adjust the nix expression to facilitate importing from outside 2019-08-16 17:49:57 +02:00
Utku Demir
e2a6305bd3 Change the way operators are formatted 2019-08-07 20:50:30 +02:00
mrkkrp
7a9aab77b3 Add nix expression for reformatting sources of arbitrary packages
See the description in readme.
2019-07-14 13:14:55 +02:00
mrkkrp
ca49003d41
Drop redundant trailing newlines in nix files 2019-06-24 20:14:49 +02:00
Luc Tielen
6b73283246 Clean nix configuration
* Point to more recent nixpkgs commit. This fixes build issue with python
  3.7.3 (only on darwin?).

* Separate shell.nix and default.nix. This is so that lorri can be used for
  development.

* Add nix output to .gitignore.

* Format *.nix using nixfmt.

* Use gitignore for filtering files in nix derivation.
2019-06-23 19:17:05 +02:00
mrkkrp
34b9b71601 Build the project with Nix and switct to GHC 8.6.4
It was decided that we're going to make the project compatible with just one
GHC version at a time. Right now this version is going to be 8.6.4.

A small refactoring included, plus support for the “deriving via” feature.
2019-05-31 14:43:15 +02:00