1
1
mirror of https://github.com/google/ormolu.git synced 2024-12-02 23:43:34 +03:00
Commit Graph

147 Commits

Author SHA1 Message Date
mrkkrp
c9f3320631
Fix a typo
[skip ci]
2019-07-06 22:26:30 +02:00
mrkkrp
94ef8f4f75
Drop ‘normalizePragma’
AFAIU it's not used anymore because we handle LANGUAGE pragmas specially
while all other pragmas are parsed properly and do not end up as comments.
2019-07-05 21:04:46 +02:00
mrkkrp
875c79d88d Implement dropping of trailing whitespace in comments 2019-07-05 21:01:45 +02:00
Dominik Kellner
6583ecb3f0 Keep space in lambdas with lazyness annotation
Fixes #144
2019-07-05 20:14:16 +02:00
waddlaw
ae40a33507 Sort language pragmas and fix their placement in modules
The approach we take here is parsing of language pragmas on creation of
comment stream and then pretty-printing them in a separate block.
2019-07-05 20:03:31 +02:00
mrkkrp
693814ca8c
Drop ‘EXAMPLES.md’
Now we're checking against many concrete examples, so this file can be
dropped.
2019-07-05 19:11:35 +02:00
mrkkrp
7c7edb8a75
Fix a typo in the readme
[skip ci]
2019-07-02 21:29:07 +02:00
mrkkrp
05e420159a
Replace current year with the word "present"
[skip ci]

Saves a lot of effort updating all those thingies every year.
2019-07-02 21:27:45 +02:00
mrkkrp
f8bad3a855 Only drop indentation present for every line in multiline comments 2019-07-01 00:07:54 +02:00
Basile Henry
faf3d86f14 Recognize gaps between comment blocks 2019-06-30 22:59:21 +02:00
mrkkrp
733e8086d4 Fix comparison of prelude imports 2019-06-30 22:42:32 +02:00
mrkkrp
8c27549532 Fix rendering of type equalities
Please see the comment in the diff.
2019-06-28 23:41:37 +02:00
mrkkrp
057977d60c Insert newlines after annotations in certain cases
Just like other pragmas annotations will now “stick” to the definitions they
pertain to. If it's not possible, there will be a newline separating them
from other declarations in the module.
2019-06-28 21:37:38 +02:00
yumiova
ba64967c03 Implement properly indented constraint contexts
Essentially, it simply indents the constraints one layer, instead of hanging the constraints off of `class` or `instance`.
2019-06-28 21:09:15 +02:00
Dmitry Ivanov
c5ed521e35 Add more function guards tests 2019-06-27 21:14:22 +02:00
Dmitry Ivanov
db8c179187 Allegedly fix function guards 2019-06-27 21:14:22 +02:00
yumiova
1654ac10a1 Implement all facets of arrow notation
Most syntactic constructs reuse pretty printing specified previously, such as arrow cases, if-expressions and lambdas. Relevant operators (such as arrow argument passing) and brackets are also formatted as operators and brackets typically are.
2019-06-27 20:49:24 +02:00
yumiova
f9842f5942 Add newlines between most declarations in a type class instance
Certain other kinds of declarations, such as instance signatures (e.g., from `InstanceSigs`) and bindings, are grouped together without newlines. The process for determining which declarations are grouped reuses the same logic as for modules and type classes.
2019-06-27 20:32:49 +02:00
Rupert Horlick
3c506ecf2b Implement printer for ‘WarningD’ 2019-06-26 22:26:31 +02:00
yumiova
bdc8738fa8 Add newlines between most declarations in a type class
Certain other kinds of declarations (such as associated type signatures and
bindings) are grouped together without newlines. The process for determining
which declarations are grouped reuses the same logic as for modules.
2019-06-25 23:26:43 +02:00
mrkkrp
ca49003d41
Drop redundant trailing newlines in nix files 2019-06-24 20:14:49 +02:00
mrkkrp
7524d6fd78
Add a couple of comments in ‘p_pat’
[skip ci]
2019-06-23 20:31:04 +02:00
sphaso
b3ebe87bf3 Support empty data declarations 2019-06-23 20:30:46 +02:00
sphaso
4f6b6171ba Implement specialize instance pragma 2019-06-23 20:16:53 +02:00
sphaso
430e0a3620 Implemented set cost centre pragma 2019-06-23 20:03:14 +02:00
Utku Demir
5565311264 Correctly print lambda case with guards 2019-06-23 19:31:16 +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
yumiova
c13a515b28 Implement pretty printing of normal & parallel list comprehensions
There are no real problems to speak of, as the formatting is obvious and consistent with what the Haskell community already does.See the tests for an example.

The reason transform list comprehensions are not implemented yet is because the GHC AST for representing list comprehensions is ahorrible mess, where slightly different list comprehensions end upcausing massively different syntax trees. The simplest way of solving this would likely be a preprocessing step that reads the syntaxtrees and produces a simple, linear list of bindings. I decided not to implement this yet to avoid delaying this commit further.
2019-06-23 18:58:20 +02:00
sphaso
3cc902102b Remove trailing whitespace from empty export list 2019-06-23 18:38:46 +02:00
Basile Henry
2fd53f6af2 Support typed and untyped splices 2019-06-23 17:59:47 +02:00
Rupert Horlick
4a0e5d4e42 [#94] Improve handling of newline before match group bodies
The PR changes the body layouting to use a span that includes the last point in
the name/pattern part of a match. This forces the layout to be multiline iff the
body starts on a newline.
2019-06-19 21:38:53 +02:00
Basile Henry
42c91987bf Use explicit error code in check mode 2019-06-19 21:28:22 +02:00
Basile Henry
b2024bfc3d Use different exit codes for different exceptions
We map every Ormulu exception to a different exit code so that they can
easily be differentiated from a shell script.
2019-06-19 21:28:22 +02:00
Rupert Horlick
c460bfa346 [#53] Implement rendering for foreign declarations
Closes #53
2019-06-19 21:20:19 +02:00
yumiova
515251c7a5 Support infix operator & multi-line class names 2019-06-19 21:09:34 +02:00
Basile Henry
73cc30c5d1 Add AnnD printer 2019-06-19 20:50:24 +02:00
waddlaw
f9c58af594 Implement rendering of ‘HsTypedSplice’ and ‘HsUntypedSplice’ 2019-06-19 20:30:55 +02:00
Basile Henry
2c6a9829ab Add CompleteMatchSig printer 2019-06-19 19:58:46 +02:00
Basile Henry
1753c7d647 Add Default declaration printer
Co-authored-by: Rupert Horlick <ruhatch@me.com>
2019-06-19 17:53:42 +02:00
Basile Henry
4955cdc4bc Add MinimalSig printer 2019-06-19 17:35:45 +02:00
Rupert Horlick
7307b6debd [#52] Implement WARNING/DEPRECATED in module header 2019-06-19 17:35:45 +02:00
Rupert Horlick
f8b920767c [#98] Fix where blocks with do notation
Closes #98
2019-06-17 10:49:58 +02:00
PanAeon
a325cd6cdf Support rendering of role annotation declarations 2019-06-16 14:49:56 +02:00
sphaso
5570439bb4 Implemenet rendering of standalone deriving 2019-06-16 14:25:57 +02:00
yumiova
7e31ae7407 Implement rendering of type class declarations 2019-06-16 13:59:10 +02:00
waddlaw
4442039c65 Implement n+k pattern 2019-06-16 08:49:55 +02:00
Rupert Horlick
cd8302a6c3 [#70] Format Pattern Synonym Signatures
This is a simple addition, adding `pattern ` in front of normal type signature
formatting
2019-06-16 08:48:28 +02:00
Domen Kožar
8f44d98b84 Expand all constructor that are missing (no Show instance) 2019-06-15 17:50:03 +02:00
mrkkrp
244144d6f4 Fix rendering of infix constructions in lhs of definitions
Also includes a minor refactoring of how type families are rendered.
2019-06-15 09:43:42 +02:00
mrkkrp
695842ec26 Make record constructors hang 2019-06-12 21:41:34 +02:00