Mark Karpov
c11c4de1ba
Implement support for fractional precedence
2024-09-17 21:56:53 +02:00
Brandon Chinn
94abee78ed
Use Choice for askDebug
2024-06-12 11:41:37 +02:00
Brandon Chinn
c71214134e
Use Choice for singleConstRec
2024-06-12 11:41:37 +02:00
Alexander Esgen
d90413c0c2
Fixity parser: don't require trailing newline
2024-06-11 15:49:00 +02:00
Alexander Esgen
9de2dfaa52
Use Data.Text.IO.Utf8
from text-2.1
2024-05-21 19:31:59 +02:00
Mark Karpov
0d060c0cea
Make Ormolu print debug info about operator fixity inference
2024-02-15 17:13:41 +01:00
Alexander Esgen
39db791bf3
Remove usage of head
/tail
(deprecated in GHC 9.8)
...
Main occurrence is the operator tree code. This commit changes
OpBranches [OpTree ty op] [op]
to
OpBranches (NonEmpty (OpTree ty op)) [op]
such that the calls to `head`/`tail`/`last` can then be replaced by pattern
matching on `:|` or by using the total replacements from `Data.List.NonEmpty`.
Still, we need to call `NE.fromList` twice. `OverloadedLists` is only used in
the tests; as it is otherwise too easy to accidentally write `[] :: NonEmpty a`
without any warning.
Alternatives to this commit are:
- Just do the absolute minimal changes required to silence the warnings (ie
basically inline `head`/`tail`).
- Rewrite the operator tree code even further (maybe using more precise types)
such that the `NE.fromList` are not necessary anymore.
2023-10-19 15:43:23 +02:00
Mark Karpov
9fabd8cfe1
Support explicit package names in module re-exports in .ormolu
...
Support explicit mention of target package name in module re-exports. Even
if the exported package is not specified as a direct dependency of the
component being formatted it will be taken into account correctly.
2023-06-05 21:36:24 +02:00
Mark Karpov
a9bb00758e
Instruct Ormolu about a common hspec re-export
2023-05-24 23:53:17 +02:00
Brandon Chinn
17ae060c19
Use defaultDependencies when cabal file does not mention file
2023-05-22 10:37:17 +02:00
Mark Karpov
8f2bc36705
Allow to specify module re-exports in .ormolu files
...
It turns out that gaining knowledge of all module re-exports in the
ecosystem is tricky because the Hoogle database does not contain this
information, so one would need to download all 14+k packages from Hackage
and parse their source code. We've decided that perhaps hardcoding some
common re-exports and otherwise giving the users a way to make Ormolu aware
of arbitrary important re-exports is a satisfactory solution for now.
Co-authored-by: amesgen <alexander.esgen@tweag.io>
2023-05-15 20:43:41 +02:00
Mark Karpov
badafc0452
Implement a more precise inference of fixity information
2023-04-24 14:39:33 +02:00
Alexander Esgen
c8f4afde2b
Switch to GHC2021, remove redundant pragmas
2023-03-31 21:13:35 +02:00
Alexander Esgen
f6dcd728b3
Pre-init Ormolu Live with Wizer
...
Co-authored-by: Cheng Shao <terrorjack@type.dance>
2023-02-17 11:25:44 +01:00
Brandon Chinn
4e8fc16479
Implement Term as an AST builder + interpreters
2023-02-01 20:39:33 +01:00
Brandon Chinn
30531f008c
Replace DList with Seq
2023-01-31 10:04:29 +01:00
Mark Karpov
c81320d8a1
Expose a more complete API from the Ormolu module
...
Co-authored-by: amesgen <alexander.esgen@tweag.io>
2023-01-25 20:27:25 +01:00
Alexander Esgen
f0b8690ae1
Use Text
as formatting input
2023-01-23 18:30:21 +01:00
Alexander Esgen
45eaf2a838
Don't use String
for operator and package names
2023-01-23 18:30:21 +01:00
Mark Karpov
9e4f22e14c
Accept CRLF line endings in .ormolu files
2023-01-17 21:14:23 +01:00
Alexander Esgen
a6dd9c16f5
Switch to binary
for parsing the fixity DB
2023-01-05 16:11:05 +01:00
Mark Karpov
b64a5fd793
Default fixity to infixl 9
2023-01-05 14:04:46 +01:00
Alexander Esgen
960caaabec
Fix Hackage extraction by reusing existing operator fixity parsers
2023-01-05 09:41:51 +01:00
Alexander Esgen
25c4ebb0ad
Remove unused Lift
instances and packages
2023-01-04 14:26:55 +01:00
Simon Hengel
e7da6bc4c2
Don't use unsafePerformIO
without need
2023-01-02 14:48:18 +01:00
Simon Hengel
9cdb3e93b0
Use it "..
instead of it "it ..
2023-01-02 14:15:42 +01:00
Alexander Esgen
54642a7966
Switch to ghc-lib-parser-9.4
2022-11-09 19:43:22 +01:00
Alexander Esgen
84a3f0eaba
Cabal file lookup: fix handling of hs-source-dirs: .
2022-07-19 19:11:49 +02:00
Mark Karpov
25b04d45b4
Fix some bugs in the diff printing code
2022-05-15 22:11:41 +02:00
Mark Karpov
4b5ba705d7
Introduce operator fixity configuration
...
Co-authored-by: amesgen <alexander.esgen@tweag.io>
2022-05-12 13:50:42 +02:00
Mark Karpov
d477a0be37
Rename Ormolu.Fixity.Types to Ormolu.Fixity.Internal
...
I think `Internal` makes it more obvious that the module is not part of the
public API (e.g. the data constructor of `LazyFixityMap` should normally
stay hidden).
2021-12-17 15:56:55 +01:00
Alexander Esgen
e3ad839959
Cache operator fixity maps
2021-12-17 14:37:44 +01:00
Thomas BAGREL
1f63136d04
Operator chain overhaul
...
See the changelog for details.
Co-authored-by: Alexander Esgen <alexander.esgen@tweag.io>
Co-authored-by: Mark Karpov <mark.karpov@tweag.io>
2021-12-16 16:23:57 +01:00
amesgen
11cda4c653
Switch to ghc-lib-parser-9.2
2021-11-16 18:16:46 +01:00
Thomas BAGREL
b889919794
Implement support for Backpack
2021-10-26 12:41:44 +02:00
Brandon Chinn
5548d632ae
Control regeneration of test examples via an env variable
2021-10-16 12:34:25 +02:00
amesgen
0bb9363e61
Improve handling of .cabal files
...
See the changelog for details.
2021-09-23 15:41:42 +02:00
amesgen
897e6736ec
Improve handling of disabled regions
...
Co-authored-by: kukimik <kukimik@poczta.onet.pl>
2021-09-13 22:22:55 +02:00
amesgen
59fced3058
Add option to respect default-extensions from .cabal files
2021-08-12 18:22:21 +02:00
amesgen
3f52afa1d3
Read and write text files using UTF8 and ignoring native line ending
2021-08-11 14:42:21 +02:00
amesgen
bec43c1098
Detect missing trailing blank lines with --mode check
2021-08-07 16:28:05 +02:00
amesgen
92aec5077f
Allow CLI GHC options to be overriden by file local options
2021-08-07 16:08:07 +02:00
Mark Karpov
ff9d64db24
Add ‘--color’ for controlling how diffs are printed
...
Also refactor the printing code and standardize how error messages are
output.
2020-11-15 20:50:38 +01:00
Mark Karpov
93bef509ca
Display diffs in the checking mode
...
Also improve the way the diffs are printed.
2020-11-14 16:44:16 +01:00
Mark Karpov
5d1612f153
Replace “idempotency” with “idempotence”
2020-04-27 15:16:40 +02:00
Mark Karpov
21dd3775e7
Fix rendering of module headers
2020-04-24 20:21:35 +02:00
Avi Dessauer
c1ea571fd3
Bump version bounds
2020-01-22 19:15:43 +01:00
Yuriy Syrovetskiy
e91ced82c4
Fix HLint warnings
2019-11-18 20:30:05 +01:00
mrkkrp
480d6edfb3
Format Ormolu with Ormolu
2019-10-03 23:10:12 +02:00
mrkkrp
87406cbd8f
Align opening/closing parentheses and other similar punctuation
2019-09-17 11:58:22 +02:00