Commit Graph

165 Commits

Author SHA1 Message Date
Vladislav Zavialov
984e4b674f Keep FunBind strictness 2019-07-13 19:38:46 +02:00
Vladislav Zavialov
63f4d1f4f4 Include source locations in diff report 2019-07-13 19:37:22 +02:00
Vladislav Zavialov
b03f989f36 Bang patterns and splices in lambdas 2019-07-13 17:45:52 +02:00
waddlaw
a7265df09e Fix printing of backticks around wildcards in operator position 2019-07-12 18:06:21 +02:00
yumiova
9e880c5299 Support transform list comprehensions 2019-07-12 17:49:16 +02:00
yumiova
069ae69a5b Support data types with infix & multi-line declarations
Fix the bug where data types with infix names & names layed out over multiple lines get incorrectly formatted. Specifically, reuse `p_infixDefHelper` to easily take care of this behavior.
2019-07-12 17:19:05 +02:00
PanAeon
c2dd159c9c Implement rendering of rewrite rule declarations 2019-07-12 17:07:54 +02:00
waddlaw
28c35cc8df Drop the mention of configuration file from readme 2019-07-08 22:30:10 +02:00
mrkkrp
a2b75213b3 Adjust rendering of kind signatures and implicit parameters
Previously there was no space between type variable and ‘::’, which is why I
started digging this in the first place.
2019-07-08 22:22:51 +02:00
mrkkrp
99619d681c Fix rendering of implicit bidirectional pattern synonyms
Previously we forgot to enable the extension, and apparently we were just
defining a function called ‘pattern’.
2019-07-08 21:46:24 +02:00
mrkkrp
3d74f2fb53 Shift ‘in’ in ‘let’ to the right to allow placing it in do blocks
It is a bit uncommon to format it like this, but this way it can be placed
without changes in do blocks as well. I think it's the right way go about
that bug.
2019-07-07 14:13:40 +02:00
mrkkrp
01486edadb Enable some non-conflicting language extensions by default 2019-07-07 13:53:59 +02:00
mrkkrp
c201862f11 Drop ‘yaml’ configuration 2019-07-07 13:53:59 +02:00
mrkkrp
d63eeea3df Mention name of file even when rendered version fails to parse
Without this info it's hard to know which file from a bulk is problematic.
2019-07-07 13:53:27 +02:00
mrkkrp
d82d607b3a Implement ‘VarBr’ 2019-07-07 13:40:48 +02:00
Tuncer Ayaz
cad7e40ae5 Allow reading from stdin 2019-07-07 12:25:22 +02:00
mrkkrp
3be1adbfc7
Add an example for case expression with preceding comment (now fixed) 2019-07-07 00:13:59 +02:00
mrkkrp
d7d4592b8e Improve handling of newlines
Now the printing code can correctly detect when hanging constructions should
be placed in non-hanging fashion from the way they are placed in input
source code.
2019-07-07 00:04:33 +02:00
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