ormolu 0.2.0.0 → 0.8.1.1
raw patch · 504 files changed
This diff is very large; some files are shown as “too large to diff”. Download the raw patch for the complete diff.
Files
- CHANGELOG.md +490/−2
- CONTRIBUTING.md +10/−22
- DESIGN.md +6/−6
- README.md +187/−51
- Setup.hs +0/−6
- app/Main.hs +248/−50
- data/cabal-tests/Bar.hs +3/−0
- data/cabal-tests/Foo.hs +3/−0
- data/cabal-tests/test.cabal +13/−0
- data/diff-tests/inputs/applicative-after.hs +8/−0
- data/diff-tests/inputs/applicative-before.hs +7/−0
- data/diff-tests/inputs/longer-v2.hs +16/−0
- data/diff-tests/inputs/longer.hs +16/−0
- data/diff-tests/outputs/no-preceding.txt +2/−1
- data/diff-tests/outputs/simple-hunk.txt +2/−1
- data/diff-tests/outputs/trimming-trailing-both-eof.txt +10/−0
- data/diff-tests/outputs/trimming-trailing-both-out-of-margin.txt +13/−0
- data/examples/declaration/class/default-signatures-out.hs +1/−3
- data/examples/declaration/class/default-signatures-simple-out.hs +1/−1
- data/examples/declaration/class/super-classes-out.hs +1/−1
- data/examples/declaration/data/ctype-0-out.hs +1/−0
- data/examples/declaration/data/ctype-0.hs +1/−0
- data/examples/declaration/data/ctype-1-out.hs +6/−0
- data/examples/declaration/data/ctype-1.hs +6/−0
- data/examples/declaration/data/ctype-out.hs +0/−1
- data/examples/declaration/data/ctype.hs +0/−1
- data/examples/declaration/data/datatype-contexts-out.hs +11/−0
- data/examples/declaration/data/datatype-contexts.hs +8/−0
- data/examples/declaration/data/existential-multiline-out.hs +1/−1
- data/examples/declaration/data/existential-out.hs +1/−1
- data/examples/declaration/data/existential-unicode-out.hs +9/−0
- data/examples/declaration/data/existential-unicode.hs +7/−0
- data/examples/declaration/data/field-layout/record-0-out.hs +10/−0
- data/examples/declaration/data/field-layout/record-0.hs +9/−0
- data/examples/declaration/data/field-layout/record-1-out.hs +11/−0
- data/examples/declaration/data/field-layout/record-1.hs +10/−0
- data/examples/declaration/data/field-layout/record-2-out.hs +7/−0
- data/examples/declaration/data/field-layout/record-2.hs +7/−0
- data/examples/declaration/data/field-layout/record-out.hs +0/−12
- data/examples/declaration/data/field-layout/record.hs +0/−11
- data/examples/declaration/data/gadt/multiline-out.hs +3/−9
- data/examples/declaration/data/gadt/multiline-where-out.hs +23/−0
- data/examples/declaration/data/gadt/multiline-where.hs +17/−0
- data/examples/declaration/data/gadt/multiple-declaration-out.hs +2/−4
- data/examples/declaration/data/gadt/unicode-out.hs +4/−0
- data/examples/declaration/data/gadt/unicode.hs +4/−0
- data/examples/declaration/data/infix-haddocks-out.hs +51/−0
- data/examples/declaration/data/infix-haddocks.hs +43/−0
- data/examples/declaration/data/invisible-binders-out.hs +2/−0
- data/examples/declaration/data/invisible-binders.hs +2/−0
- data/examples/declaration/data/linear-out.hs +11/−0
- data/examples/declaration/data/linear.hs +10/−0
- data/examples/declaration/data/record-fancy-existential-out.hs +6/−0
- data/examples/declaration/data/record-fancy-existential.hs +5/−0
- data/examples/declaration/data/record-out.hs +1/−1
- data/examples/declaration/data/record.hs +1/−1
- data/examples/declaration/data/required-type-arguments-out.hs +27/−0
- data/examples/declaration/data/required-type-arguments.hs +24/−0
- data/examples/declaration/data/simple-broken-out.hs +2/−1
- data/examples/declaration/data/single-constructor-with-haddock-out.hs +7/−0
- data/examples/declaration/data/single-constructor-with-haddock.hs +6/−0
- data/examples/declaration/data/type-data-out.hs +8/−0
- data/examples/declaration/data/type-data.hs +7/−0
- data/examples/declaration/data/unnamed-field-comment-0-out.hs +2/−2
- data/examples/declaration/data/unnamed-field-comment-1-out.hs +1/−1
- data/examples/declaration/data/unnamed-field-comment-2-out.hs +11/−0
- data/examples/declaration/data/unnamed-field-comment-2.hs +9/−0
- data/examples/declaration/data/unnamed-field-comment-3-out.hs +5/−0
- data/examples/declaration/data/unnamed-field-comment-3.hs +1/−0
- data/examples/declaration/data/wildcard-binders-out.hs +1/−0
- data/examples/declaration/data/wildcard-binders.hs +1/−0
- data/examples/declaration/default/default-out.hs +8/−0
- data/examples/declaration/default/default.hs +7/−0
- data/examples/declaration/foreign/foreign-import-multiline-out.hs +8/−0
- data/examples/declaration/foreign/foreign-import-multiline.hs +6/−0
- data/examples/declaration/instance/contexts-out.hs +1/−1
- data/examples/declaration/instance/newlines-between-methods-out.hs +1/−1
- data/examples/declaration/rewrite-rule/never-active-out.hs +1/−0
- data/examples/declaration/rewrite-rule/never-active.hs +1/−0
- data/examples/declaration/rewrite-rule/prelude2-out.hs +1/−1
- data/examples/declaration/rewrite-rule/prelude2.hs +1/−1
- data/examples/declaration/rewrite-rule/type-signature-out.hs +1/−3
- data/examples/declaration/signature/fixity/infix-out.hs +6/−0
- data/examples/declaration/signature/fixity/infix.hs +6/−0
- data/examples/declaration/signature/fixity/infixl-out.hs +2/−0
- data/examples/declaration/signature/fixity/infixl.hs +2/−0
- data/examples/declaration/signature/fixity/infixr-out.hs +2/−0
- data/examples/declaration/signature/fixity/infixr.hs +2/−0
- data/examples/declaration/signature/inline/noinline-out.hs +4/−0
- data/examples/declaration/signature/inline/noinline.hs +4/−0
- data/examples/declaration/signature/specialize/specialize-2-out.hs +8/−0
- data/examples/declaration/signature/specialize/specialize-2.hs +9/−0
- data/examples/declaration/signature/specialize/specialize-3-out.hs +10/−0
- data/examples/declaration/signature/specialize/specialize-3.hs +4/−0
- data/examples/declaration/signature/specialize/specialize-instance-out.hs +1/−2
- data/examples/declaration/signature/specialize/specialize-out.hs +4/−4
- data/examples/declaration/signature/type/unicode-out.hs +1/−1
- data/examples/declaration/splice/bracket-unicode-out.hs +6/−0
- data/examples/declaration/splice/bracket-unicode.hs +6/−0
- data/examples/declaration/splice/quasiquote-out.hs +4/−0
- data/examples/declaration/splice/quasiquote.hs +3/−0
- data/examples/declaration/splice/typed-splice-out.hs +1/−2
- data/examples/declaration/type-families/closed-type-family/multi-line-out.hs +5/−0
- data/examples/declaration/type-families/closed-type-family/multi-line.hs +4/−0
- data/examples/declaration/type-families/closed-type-family/promotion-out.hs +2/−0
- data/examples/declaration/type-families/closed-type-family/promotion.hs +2/−0
- data/examples/declaration/type-families/closed-type-family/with-comments-out.hs +10/−0
- data/examples/declaration/type-families/closed-type-family/with-comments.hs +12/−0
- data/examples/declaration/type-synonyms/multi-line-out.hs +6/−0
- data/examples/declaration/type-synonyms/multi-line.hs +5/−0
- data/examples/declaration/type/parens-comments-out.hs +4/−0
- data/examples/declaration/type/parens-comments.hs +3/−0
- data/examples/declaration/type/promotion-1-out.hs +4/−0
- data/examples/declaration/type/promotion-1.hs +4/−0
- data/examples/declaration/type/promotion-no-puns-out.hs +5/−0
- data/examples/declaration/type/promotion-no-puns.hs +5/−0
- data/examples/declaration/type/wildcard-binders-out.hs +1/−0
- data/examples/declaration/type/wildcard-binders.hs +1/−0
- data/examples/declaration/value/function/application-1-out.hs +11/−11
- data/examples/declaration/value/function/application-2-out.hs +8/−10
- data/examples/declaration/value/function/arrow/proc-applications2-out.hs +2/−1
- data/examples/declaration/value/function/arrow/proc-do-complex-out.hs +7/−3
- data/examples/declaration/value/function/arrow/proc-do-complex.hs +4/−1
- data/examples/declaration/value/function/arrow/proc-do-simple1-out.hs +13/−2
- data/examples/declaration/value/function/arrow/proc-do-simple1.hs +10/−0
- data/examples/declaration/value/function/arrow/proc-do-simple2-out.hs +3/−2
- data/examples/declaration/value/function/arrow/proc-do-simple2.hs +2/−0
- data/examples/declaration/value/function/arrow/proc-form-do-indent-out.hs +9/−1
- data/examples/declaration/value/function/arrow/proc-form-do-indent.hs +5/−0
- data/examples/declaration/value/function/arrow/proc-forms2-out.hs +20/−15
- data/examples/declaration/value/function/arrow/proc-forms2.hs +5/−0
- data/examples/declaration/value/function/arrow/proc-lambdas-out.hs +2/−1
- data/examples/declaration/value/function/arrow/proc-parentheses-out.hs +1/−2
- data/examples/declaration/value/function/block-arguments-out.hs +2/−0
- data/examples/declaration/value/function/block-arguments.hs +2/−0
- data/examples/declaration/value/function/case-empty-out.hs +6/−0
- data/examples/declaration/value/function/case-empty.hs +6/−0
- data/examples/declaration/value/function/case-multi-line-guards-out.hs +2/−2
- data/examples/declaration/value/function/case-single-line-with-braces-out.hs +2/−0
- data/examples/declaration/value/function/case-single-line-with-braces.hs +2/−0
- data/examples/declaration/value/function/comprehension/transform-monad-out.hs +10/−10
- data/examples/declaration/value/function/comprehension/transform-multi-line1-out.hs +5/−5
- data/examples/declaration/value/function/comprehension/transform-multi-line2-out.hs +9/−9
- data/examples/declaration/value/function/comprehension/transform-multi-line3-out.hs +5/−5
- data/examples/declaration/value/function/comprehension/transform-multi-line4-out.hs +10/−10
- data/examples/declaration/value/function/do-multiline-with-case-out.hs +13/−0
- data/examples/declaration/value/function/do-multiline-with-case.hs +13/−0
- data/examples/declaration/value/function/do-single-line-case-guards-out.hs +2/−0
- data/examples/declaration/value/function/do-single-line-case-guards.hs +2/−0
- data/examples/declaration/value/function/do-single-line-lambda-case-out.hs +2/−0
- data/examples/declaration/value/function/do-single-line-lambda-case.hs +2/−0
- data/examples/declaration/value/function/do-single-line-multiple-cases-out.hs +2/−0
- data/examples/declaration/value/function/do-single-line-multiple-cases.hs +2/−0
- data/examples/declaration/value/function/do-single-line-nested-case-out.hs +2/−0
- data/examples/declaration/value/function/do-single-line-nested-case.hs +2/−0
- data/examples/declaration/value/function/do-single-line-with-case-out.hs +2/−0
- data/examples/declaration/value/function/do-single-line-with-case.hs +2/−0
- data/examples/declaration/value/function/do/do-dollar-mixed-chain-out.hs +23/−0
- data/examples/declaration/value/function/do/do-dollar-mixed-chain.hs +23/−0
- data/examples/declaration/value/function/fancy-forall-0-out.hs +2/−3
- data/examples/declaration/value/function/fancy-forall-1-out.hs +2/−3
- data/examples/declaration/value/function/guards-out.hs +2/−0
- data/examples/declaration/value/function/guards.hs +2/−0
- data/examples/declaration/value/function/if-single-line-functions-do-out.hs +5/−0
- data/examples/declaration/value/function/if-single-line-functions-do.hs +5/−0
- data/examples/declaration/value/function/if-single-line-functions-out.hs +4/−0
- data/examples/declaration/value/function/if-single-line-functions.hs +4/−0
- data/examples/declaration/value/function/if-with-comment-above-branches-out.hs +7/−0
- data/examples/declaration/value/function/if-with-comment-above-branches.hs +8/−0
- data/examples/declaration/value/function/if-with-comment-before-do-blocks-out.hs +10/−0
- data/examples/declaration/value/function/if-with-comment-before-do-blocks.hs +10/−0
- data/examples/declaration/value/function/if-with-comment-in-branches-out.hs +14/−0
- data/examples/declaration/value/function/if-with-comment-in-branches-with-functions-out.hs +12/−0
- data/examples/declaration/value/function/if-with-comment-in-branches-with-functions.hs +12/−0
- data/examples/declaration/value/function/if-with-comment-in-branches.hs +14/−0
- data/examples/declaration/value/function/if-with-comment-next-to-keyword-out.hs +10/−0
- data/examples/declaration/value/function/if-with-comment-next-to-keyword.hs +10/−0
- data/examples/declaration/value/function/if-with-comment-out.hs +0/−8
- data/examples/declaration/value/function/if-with-comment.hs +0/−8
- data/examples/declaration/value/function/implicit-params-out.hs +1/−2
- data/examples/declaration/value/function/infix/applicative-out.hs +2/−1
- data/examples/declaration/value/function/infix/dollar-chains-1-out.hs +22/−0
- data/examples/declaration/value/function/infix/dollar-chains-1.hs +22/−0
- data/examples/declaration/value/function/infix/dollar-chains-2-out.hs +17/−0
- data/examples/declaration/value/function/infix/dollar-chains-2.hs +18/−0
- data/examples/declaration/value/function/infix/dollar-chains-3-out.hs +11/−0
- data/examples/declaration/value/function/infix/dollar-chains-3.hs +9/−0
- data/examples/declaration/value/function/infix/dollar-chains-4-out.hs +5/−0
- data/examples/declaration/value/function/infix/dollar-chains-4.hs +4/−0
- data/examples/declaration/value/function/infix/dollar-chains-5-out.hs +11/−0
- data/examples/declaration/value/function/infix/dollar-chains-5.hs +10/−0
- data/examples/declaration/value/function/infix/dollar-chains-6-out.hs +11/−0
- data/examples/declaration/value/function/infix/dollar-chains-6.hs +10/−0
- data/examples/declaration/value/function/infix/dollar-chains-out.hs +0/−22
- data/examples/declaration/value/function/infix/dollar-chains.hs +0/−22
- data/examples/declaration/value/function/infix/esqueleto-0-out.hs +12/−0
- data/examples/declaration/value/function/infix/esqueleto-0.hs +10/−0
- data/examples/declaration/value/function/infix/esqueleto-1-out.hs +9/−0
- data/examples/declaration/value/function/infix/esqueleto-1.hs +9/−0
- data/examples/declaration/value/function/infix/fractional-precedence-out.hs +3/−0
- data/examples/declaration/value/function/infix/fractional-precedence.hs +3/−0
- data/examples/declaration/value/function/infix/hspec-expectation-out.hs +8/−0
- data/examples/declaration/value/function/infix/hspec-expectation.hs +8/−0
- data/examples/declaration/value/function/infix/lenses-out.hs +4/−1
- data/examples/declaration/value/function/infix/lenses.hs +2/−0
- data/examples/declaration/value/function/infix/op-chain-colon-do-out.hs +10/−0
- data/examples/declaration/value/function/infix/op-chain-colon-do.hs +10/−0
- data/examples/declaration/value/function/infix/op-chain-l-eq-out.hs +11/−0
- data/examples/declaration/value/function/infix/op-chain-l-eq.hs +11/−0
- data/examples/declaration/value/function/infix/op-chain-l-gt-out.hs +11/−0
- data/examples/declaration/value/function/infix/op-chain-l-gt.hs +11/−0
- data/examples/declaration/value/function/infix/op-chain-l-lt-out.hs +11/−0
- data/examples/declaration/value/function/infix/op-chain-l-lt.hs +11/−0
- data/examples/declaration/value/function/infix/op-chain-l-s-out.hs +7/−0
- data/examples/declaration/value/function/infix/op-chain-l-s.hs +7/−0
- data/examples/declaration/value/function/infix/op-chain-r-eq-colon-1-out.hs +11/−0
- data/examples/declaration/value/function/infix/op-chain-r-eq-colon-1.hs +11/−0
- data/examples/declaration/value/function/infix/op-chain-r-eq-colon-2-out.hs +11/−0
- data/examples/declaration/value/function/infix/op-chain-r-eq-colon-2.hs +11/−0
- data/examples/declaration/value/function/infix/op-chain-r-eq-dollar-1-out.hs +11/−0
- data/examples/declaration/value/function/infix/op-chain-r-eq-dollar-1.hs +11/−0
- data/examples/declaration/value/function/infix/op-chain-r-eq-dollar-2-out.hs +11/−0
- data/examples/declaration/value/function/infix/op-chain-r-eq-dollar-2.hs +11/−0
- data/examples/declaration/value/function/infix/op-chain-r-eq-normal-out.hs +11/−0
- data/examples/declaration/value/function/infix/op-chain-r-eq-normal.hs +11/−0
- data/examples/declaration/value/function/infix/op-chain-r-gt-colon-1-out.hs +11/−0
- data/examples/declaration/value/function/infix/op-chain-r-gt-colon-1.hs +11/−0
- data/examples/declaration/value/function/infix/op-chain-r-gt-colon-2-out.hs +11/−0
- data/examples/declaration/value/function/infix/op-chain-r-gt-colon-2.hs +11/−0
- data/examples/declaration/value/function/infix/op-chain-r-gt-dollar-out.hs +11/−0
- data/examples/declaration/value/function/infix/op-chain-r-gt-dollar.hs +11/−0
- data/examples/declaration/value/function/infix/op-chain-r-gt-normal-out.hs +11/−0
- data/examples/declaration/value/function/infix/op-chain-r-gt-normal.hs +11/−0
- data/examples/declaration/value/function/infix/op-chain-r-lt-colon-1-out.hs +11/−0
- data/examples/declaration/value/function/infix/op-chain-r-lt-colon-1.hs +11/−0
- data/examples/declaration/value/function/infix/op-chain-r-lt-colon-2-out.hs +11/−0
- data/examples/declaration/value/function/infix/op-chain-r-lt-colon-2.hs +11/−0
- data/examples/declaration/value/function/infix/op-chain-r-lt-dollar-out.hs +11/−0
- data/examples/declaration/value/function/infix/op-chain-r-lt-dollar.hs +11/−0
- data/examples/declaration/value/function/infix/op-chain-r-lt-normal-out.hs +11/−0
- data/examples/declaration/value/function/infix/op-chain-r-lt-normal.hs +11/−0
- data/examples/declaration/value/function/infix/op-chain-r-s-colon-out.hs +7/−0
- data/examples/declaration/value/function/infix/op-chain-r-s-colon.hs +7/−0
- data/examples/declaration/value/function/infix/op-chain-r-s-dollar-out.hs +7/−0
- data/examples/declaration/value/function/infix/op-chain-r-s-dollar.hs +7/−0
- data/examples/declaration/value/function/infix/op-chain-r-s-normal-out.hs +7/−0
- data/examples/declaration/value/function/infix/op-chain-r-s-normal.hs +7/−0
- data/examples/declaration/value/function/infix/qualified-ops-out.hs +9/−0
- data/examples/declaration/value/function/infix/qualified-ops.hs +7/−0
- data/examples/declaration/value/function/infix/qualified-prelude-out.hs +12/−0
- data/examples/declaration/value/function/infix/qualified-prelude.hs +12/−0
- data/examples/declaration/value/function/infix/tricky-colon-chain-out.hs +9/−0
- data/examples/declaration/value/function/infix/tricky-colon-chain.hs +9/−0
- data/examples/declaration/value/function/lambda-case-out.hs +14/−0
- data/examples/declaration/value/function/lambda-case.hs +14/−0
- data/examples/declaration/value/function/let-multi-line-out.hs +1/−1
- data/examples/declaration/value/function/linear-bindings-out.hs +9/−0
- data/examples/declaration/value/function/linear-bindings.hs +9/−0
- data/examples/declaration/value/function/list-comprehensions-out.hs +36/−17
- data/examples/declaration/value/function/list-comprehensions.hs +16/−0
- data/examples/declaration/value/function/list-notation-0-out.hs +4/−4
- data/examples/declaration/value/function/list-notation-1-out.hs +5/−5
- data/examples/declaration/value/function/list-notation-2-out.hs +4/−4
- data/examples/declaration/value/function/list-notation-3-out.hs +7/−9
- data/examples/declaration/value/function/multi-way-if-out.hs +5/−3
- data/examples/declaration/value/function/multi-way-if.hs +2/−0
- data/examples/declaration/value/function/multiline-strings-0-out.hs +29/−0
- data/examples/declaration/value/function/multiline-strings-0.hs +31/−0
- data/examples/declaration/value/function/multiline-strings-1-out.hs +12/−0
- data/examples/declaration/value/function/multiline-strings-1.hs +13/−0
- data/examples/declaration/value/function/multiline-strings-2-out.hs +11/−0
- data/examples/declaration/value/function/multiline-strings-2.hs +11/−0
- data/examples/declaration/value/function/multiline-strings-3-out.hs +32/−0
- data/examples/declaration/value/function/multiline-strings-3.hs +32/−0
- data/examples/declaration/value/function/multiline-strings-4-out.hs +25/−0
- data/examples/declaration/value/function/multiline-strings-4.hs +26/−0
- data/examples/declaration/value/function/multiline-strings-5-out.hs +26/−0
- data/examples/declaration/value/function/multiline-strings-5.hs +26/−0
- data/examples/declaration/value/function/multiline-strings-6-out.hs +10/−0
- data/examples/declaration/value/function/multiline-strings-6.hs +10/−0
- data/examples/declaration/value/function/multiline-strings-7-out.hs +30/−0
- data/examples/declaration/value/function/multiline-strings-7.hs +30/−0
- data/examples/declaration/value/function/multiline-strings-8-out.hs +12/−0
- data/examples/declaration/value/function/multiline-strings-8.hs +9/−0
- data/examples/declaration/value/function/multiline-strings-9-out.hs +11/−0
- data/examples/declaration/value/function/multiline-strings-9.hs +11/−0
- data/examples/declaration/value/function/multiline-types-out.hs +17/−0
- data/examples/declaration/value/function/multiline-types.hs +15/−0
- data/examples/declaration/value/function/multiple-guards-out.hs +4/−4
- data/examples/declaration/value/function/multiple-guards.hs +2/−3
- data/examples/declaration/value/function/operator-fixity-defaulting-out.hs +12/−0
- data/examples/declaration/value/function/operator-fixity-defaulting.hs +12/−0
- data/examples/declaration/value/function/operator-hash-with-unboxed-sums-out.hs +8/−0
- data/examples/declaration/value/function/operator-hash-with-unboxed-sums.hs +8/−0
- data/examples/declaration/value/function/operator-hash-without-unboxed-sums-out.hs +6/−0
- data/examples/declaration/value/function/operator-hash-without-unboxed-sums.hs +6/−0
- data/examples/declaration/value/function/operators-0-out.hs +4/−1
- data/examples/declaration/value/function/operators-0.hs +2/−0
- data/examples/declaration/value/function/operators-2-out.hs +4/−2
- data/examples/declaration/value/function/operators-3-out.hs +6/−1
- data/examples/declaration/value/function/operators-3.hs +2/−0
- data/examples/declaration/value/function/operators-4-out.hs +6/−1
- data/examples/declaration/value/function/operators-4.hs +2/−0
- data/examples/declaration/value/function/operators-6-out.hs +2/−0
- data/examples/declaration/value/function/operators-6.hs +2/−0
- data/examples/declaration/value/function/operators-7-out.hs +1/−0
- data/examples/declaration/value/function/operators-7.hs +1/−0
- data/examples/declaration/value/function/overloaded-labels-out.hs +33/−0
- data/examples/declaration/value/function/overloaded-labels.hs +30/−0
- data/examples/declaration/value/function/parallel-comprehensions-complex-out.hs +21/−21
- data/examples/declaration/value/function/parens-comments-out.hs +4/−0
- data/examples/declaration/value/function/parens-comments.hs +3/−0
- data/examples/declaration/value/function/pattern/many-guards-in-singleline-out.hs +3/−0
- data/examples/declaration/value/function/pattern/many-guards-in-singleline.hs +3/−0
- data/examples/declaration/value/function/pattern/multiline-guard-statement-out.hs +6/−0
- data/examples/declaration/value/function/pattern/multiline-guard-statement.hs +5/−0
- data/examples/declaration/value/function/pattern/multiple-guard-statements-out.hs +6/−0
- data/examples/declaration/value/function/pattern/multiple-guard-statements.hs +4/−0
- data/examples/declaration/value/function/pattern/or-patterns-out.hs +44/−0
- data/examples/declaration/value/function/pattern/or-patterns.hs +39/−0
- data/examples/declaration/value/function/pragmas-out.hs +6/−1
- data/examples/declaration/value/function/pragmas.hs +4/−0
- data/examples/declaration/value/function/primitive-literals-out.hs +10/−0
- data/examples/declaration/value/function/primitive-literals.hs +9/−0
- data/examples/declaration/value/function/record/dot-multiline-out.hs +0/−15
- data/examples/declaration/value/function/record/dot-multiline.hs +0/−10
- data/examples/declaration/value/function/record/dot-singleline-out.hs +0/−15
- data/examples/declaration/value/function/record/dot-singleline.hs +0/−14
- data/examples/declaration/value/function/record/record-dot-out.hs +16/−0
- data/examples/declaration/value/function/record/record-dot.hs +16/−0
- data/examples/declaration/value/function/required-type-arguments-2-out.hs +23/−0
- data/examples/declaration/value/function/required-type-arguments-2.hs +14/−0
- data/examples/declaration/value/function/required-type-arguments-out.hs +21/−0
- data/examples/declaration/value/function/required-type-arguments.hs +13/−0
- data/examples/declaration/value/function/strings-out.hs +5/−1
- data/examples/declaration/value/function/strings.hs +4/−0
- data/examples/declaration/value/function/type-abstractions-out.hs +9/−0
- data/examples/declaration/value/function/type-abstractions.hs +8/−0
- data/examples/declaration/value/function/type-applications-out.hs +10/−0
- data/examples/declaration/value/function/type-applications.hs +8/−0
- data/examples/declaration/value/function/unboxed-sums-out.hs +16/−0
- data/examples/declaration/value/function/unboxed-sums.hs +9/−0
- data/examples/declaration/value/function/unboxed-tuples-out.hs +3/−0
- data/examples/declaration/value/function/unboxed-tuples.hs +3/−0
- data/examples/declaration/value/pattern-synonyms/explicitely-bidirectional-out.hs +2/−4
- data/examples/declaration/warning/warning-multiline-out.hs +9/−0
- data/examples/declaration/warning/warning-multiline.hs +8/−0
- data/examples/declaration/warning/warning-single-line-out.hs +13/−2
- data/examples/declaration/warning/warning-single-line.hs +11/−2
- data/examples/import/data-out.hs +3/−0
- data/examples/import/data.hs +6/−0
- data/examples/import/deprecated-export-multi-line-out.hs +7/−0
- data/examples/import/deprecated-export-multi-line.hs +5/−0
- data/examples/import/deprecated-export-single-line-out.hs +3/−0
- data/examples/import/deprecated-export-single-line.hs +1/−0
- data/examples/import/docstrings-after-exports-out.hs +12/−0
- data/examples/import/docstrings-after-exports.hs +11/−0
- data/examples/import/explicit-level-imports-out.hs +13/−0
- data/examples/import/explicit-level-imports-qualified-post-out.hs +5/−0
- data/examples/import/explicit-level-imports-qualified-post.hs +5/−0
- data/examples/import/explicit-level-imports.hs +14/−0
- data/examples/import/sorted-package-imports-out.hs +9/−0
- data/examples/import/sorted-package-imports.hs +10/−0
- data/examples/module-header/empty-haddock-out.hs +1/−0
- data/examples/module-header/empty-haddock.hs +3/−0
- data/examples/module-header/multiline-empty-comment-out.hs +4/−0
- data/examples/module-header/multiline-empty-comment.hs +2/−0
- data/examples/other/argument-comment-out.hs +2/−2
- data/examples/other/comment-empty-let-out.hs +6/−0
- data/examples/other/comment-empty-let.hs +6/−0
- data/examples/other/comment-spacing-out.hs +7/−0
- data/examples/other/comment-spacing.hs +7/−0
- data/examples/other/cpp/continuation-out.hs +2/−0
- data/examples/other/cpp/continuation.hs +2/−0
- data/examples/other/cpp/cpp-and-imports-out.hs +8/−0
- data/examples/other/cpp/cpp-and-imports.hs +8/−0
- data/examples/other/cpp/lonely-hash-out.hs +2/−0
- data/examples/other/cpp/lonely-hash.hs +2/−0
- data/examples/other/cpp/separation-0a-out.hs +3/−2
- data/examples/other/cpp/separation-0a.hs +2/−0
- data/examples/other/cpp/separation-0b-out.hs +3/−2
- data/examples/other/cpp/separation-0b.hs +2/−0
- data/examples/other/cpp/separation-1a-out.hs +2/−1
- data/examples/other/cpp/separation-1a.hs +2/−0
- data/examples/other/cpp/separation-1b-out.hs +2/−1
- data/examples/other/cpp/separation-1b.hs +2/−0
- data/examples/other/cpp/separation-2a-out.hs +2/−1
- data/examples/other/cpp/separation-2a.hs +2/−0
- data/examples/other/cpp/separation-2b-out.hs +2/−0
- data/examples/other/cpp/separation-2b.hs +2/−0
- data/examples/other/cpp/shifted-out.hs +2/−0
- data/examples/other/cpp/shifted.hs +2/−0
- data/examples/other/cpp/simple-import-out.hs +2/−0
- data/examples/other/cpp/simple-import.hs +2/−0
- data/examples/other/disabling/closing-comment-in-disabled-region-out.hs +3/−0
- data/examples/other/disabling/closing-comment-in-disabled-region.hs +3/−0
- data/examples/other/disabling/empty-disabled-region-out.hs +7/−0
- data/examples/other/disabling/empty-disabled-region.hs +7/−0
- data/examples/other/disabling/indented-fragment-out.hs +0/−7
- data/examples/other/disabling/indented-fragment.hs +0/−7
- data/examples/other/disabling/line-pragma-in-disabled-region-out.hs too large to diff
- data/examples/other/disabling/line-pragma-in-disabled-region.hs too large to diff
- data/examples/other/disabling/normalize-magic-comments-out.hs too large to diff
- data/examples/other/disabling/normalize-magic-comments.hs too large to diff
- data/examples/other/disabling/preserve-empty-lines-out.hs too large to diff
- data/examples/other/disabling/preserve-empty-lines.hs too large to diff
- data/examples/other/disabling/preserve-trailing-whitespace-out.hs too large to diff
- data/examples/other/disabling/preserve-trailing-whitespace.hs too large to diff
- data/examples/other/disabling/suffix-comment-out.hs too large to diff
- data/examples/other/disabling/suffix-comment.hs too large to diff
- data/examples/other/empty-forall-out.hs too large to diff
- data/examples/other/empty-haddock-out.hs too large to diff
- data/examples/other/empty-haddock.hs too large to diff
- data/examples/other/inline-comment-1-out.hs too large to diff
- data/examples/other/invalid-haddock-1-out.hs too large to diff
- data/examples/other/invalid-haddock-1.hs too large to diff
- data/examples/other/invalid-haddock-2-out.hs too large to diff
- data/examples/other/invalid-haddock-2.hs too large to diff
- data/examples/other/invalid-haddock-double-trigger-out.hs too large to diff
- data/examples/other/invalid-haddock-double-trigger.hs too large to diff
- data/examples/other/invalid-haddock-weird-out.hs too large to diff
- data/examples/other/invalid-haddock-weird.hs too large to diff
- data/examples/other/jsffi-out.hs too large to diff
- data/examples/other/jsffi.hs too large to diff
- data/examples/other/multiline-forall-out.hs too large to diff
- data/examples/other/necessary-brackets-out.hs too large to diff
- data/examples/other/necessary-brackets.hs too large to diff
- data/examples/other/no-linear-arrows-out.hs too large to diff
- data/examples/other/no-linear-arrows.hs too large to diff
- data/examples/other/pragma-sorting-out.hs too large to diff
- data/examples/other/pragma-sorting.hs too large to diff
- data/parse-failures/disabling-preserves-error-location.hs too large to diff
- data/parse-failures/line-pragma.hs too large to diff
- extract-hackage-info/hackage-info.bin too large to diff
- ormolu.cabal too large to diff
- src/GHC/DynFlags.hs too large to diff
- src/Ormolu.hs too large to diff
- src/Ormolu/Config.hs too large to diff
- src/Ormolu/Diff/ParseResult.hs too large to diff
- src/Ormolu/Diff/Text.hs too large to diff
- src/Ormolu/Exception.hs too large to diff
- src/Ormolu/Fixity.hs too large to diff
- src/Ormolu/Fixity/Imports.hs too large to diff
- src/Ormolu/Fixity/Internal.hs too large to diff
- src/Ormolu/Fixity/Parser.hs too large to diff
- src/Ormolu/Fixity/Printer.hs too large to diff
- src/Ormolu/Imports.hs too large to diff
- src/Ormolu/Parser.hs too large to diff
- src/Ormolu/Parser/Anns.hs too large to diff
- src/Ormolu/Parser/CommentStream.hs too large to diff
- src/Ormolu/Parser/Pragma.hs too large to diff
- src/Ormolu/Parser/Result.hs too large to diff
- src/Ormolu/Parser/Shebang.hs too large to diff
- src/Ormolu/Printer.hs too large to diff
- src/Ormolu/Printer/Combinators.hs too large to diff
- src/Ormolu/Printer/Comments.hs too large to diff
- src/Ormolu/Printer/Internal.hs too large to diff
- src/Ormolu/Printer/Meat/Common.hs too large to diff
- src/Ormolu/Printer/Meat/Declaration.hs too large to diff
- src/Ormolu/Printer/Meat/Declaration/Annotation.hs too large to diff
- src/Ormolu/Printer/Meat/Declaration/Class.hs too large to diff
- src/Ormolu/Printer/Meat/Declaration/Data.hs too large to diff
- src/Ormolu/Printer/Meat/Declaration/Default.hs too large to diff
- src/Ormolu/Printer/Meat/Declaration/Foreign.hs too large to diff
- src/Ormolu/Printer/Meat/Declaration/Instance.hs too large to diff
- src/Ormolu/Printer/Meat/Declaration/OpTree.hs too large to diff
- src/Ormolu/Printer/Meat/Declaration/OpTree.hs-boot too large to diff
- src/Ormolu/Printer/Meat/Declaration/RoleAnnotation.hs too large to diff
- src/Ormolu/Printer/Meat/Declaration/Rule.hs too large to diff
- src/Ormolu/Printer/Meat/Declaration/Signature.hs too large to diff
- src/Ormolu/Printer/Meat/Declaration/Signature.hs-boot too large to diff
- src/Ormolu/Printer/Meat/Declaration/Splice.hs too large to diff
- src/Ormolu/Printer/Meat/Declaration/StringLiteral.hs too large to diff
- src/Ormolu/Printer/Meat/Declaration/Type.hs too large to diff
- src/Ormolu/Printer/Meat/Declaration/TypeFamily.hs too large to diff
- src/Ormolu/Printer/Meat/Declaration/Value.hs too large to diff
- src/Ormolu/Printer/Meat/Declaration/Value.hs-boot too large to diff
- src/Ormolu/Printer/Meat/Declaration/Warning.hs too large to diff
- src/Ormolu/Printer/Meat/ImportExport.hs too large to diff
- src/Ormolu/Printer/Meat/Module.hs too large to diff
- src/Ormolu/Printer/Meat/Pragma.hs too large to diff
- src/Ormolu/Printer/Meat/Type.hs too large to diff
- src/Ormolu/Printer/Operators.hs too large to diff
- src/Ormolu/Printer/SpanStream.hs too large to diff
- src/Ormolu/Processing/Common.hs too large to diff
- src/Ormolu/Processing/Cpp.hs too large to diff
- src/Ormolu/Processing/Postprocess.hs too large to diff
- src/Ormolu/Processing/Preprocess.hs too large to diff
- src/Ormolu/Terminal.hs too large to diff
- src/Ormolu/Terminal/QualifiedDo.hs too large to diff
- src/Ormolu/Utils.hs too large to diff
- src/Ormolu/Utils/Cabal.hs too large to diff
- src/Ormolu/Utils/Fixity.hs too large to diff
- src/Ormolu/Utils/IO.hs too large to diff
- tests/Ormolu/CabalInfoSpec.hs too large to diff
- tests/Ormolu/Diff/TextSpec.hs too large to diff
- tests/Ormolu/Fixity/ParserSpec.hs too large to diff
- tests/Ormolu/Fixity/PrinterSpec.hs too large to diff
- tests/Ormolu/FixitySpec.hs too large to diff
- tests/Ormolu/OpTreeSpec.hs too large to diff
- tests/Ormolu/Parser/OptionsSpec.hs too large to diff
- tests/Ormolu/Parser/ParseFailureSpec.hs too large to diff
- tests/Ormolu/Parser/PragmaSpec.hs too large to diff
- tests/Ormolu/PrinterSpec.hs too large to diff
@@ -1,3 +1,490 @@+## Ormolu 0.8.1.1++* Add missing braces for case expressions in single‑line do blocks. [Issue+ 1180](https://github.com/tweag/ormolu/issues/1180).++* Fix the import grouping logic in the presence of imports with explicit+ levels. [Issue 1192](https://github.com/tweag/ormolu/issues/1192).++## Ormolu 0.8.1.0++* Fixed printing of guards on pattern binds. [Issue+ 1178](https://github.com/tweag/ormolu/issues/1178).++* Switched to `ghc-lib-parser-9.14`, with the following new syntactic features:+ * GHC proposal [#493](https://github.com/ghc-proposals/ghc-proposals/blob/e2c683698323cec3e33625369ae2b5f585387c70/proposals/0493-specialise-expressions.rst): expressions in SPECIALISE pragmas+ * Multiline strings in foreign import declarations.+ * `ExplicitNamespaces` supports the `data` namespace specifier in import and export lists, replacing `pattern`.+ * `LinearTypes` adds new syntax to support non-linear record fields.+ * `RequiredTypeArguments` allows visible forall in GADT syntax.++* Updated to `Cabal-syntax-3.16`.++* Correctly format string literals containing the `\^\` escape sequence. [Issue+ 1165](https://github.com/tweag/ormolu/issues/1165).++* Correctly preserve consecutive blank lines in multiline strings. [Issue+ 1194](https://github.com/tweag/ormolu/issues/1194).++* Fixed printing of multi-line or-patterns inside as-patterns. [Issue+ 1183](https://github.com/tweag/ormolu/issues/1183).++* Fixed an issue where or-patterns would be indented twice. [Issue+ 1188](https://github.com/tweag/ormolu/issues/1188).++* Add support for `ExplicitLevelImports`. [Issue+ 1192](https://github.com/tweag/ormolu/issues/1192).++## Ormolu 0.8.0.2++* Fixed a performance regression introduced in 0.8.0.0. [Issue+ 1176](https://github.com/tweag/ormolu/issues/1176).++## Ormolu 0.8.0.1++* Correctly format edge cases where fully collapsing string gaps changes the+ string represented by a string literal. [Issue+ 1160](https://github.com/tweag/ormolu/issues/1160).++* Fix false positives in AST diffing in fixity declarations with implicit+ fixity, such as `infix +`. [Issue+ 1166](https://github.com/tweag/ormolu/issues/1166).++* Make multiline function signatures in RequiredTypeArguments consistent with+ types [PR 1170](https://github.com/tweag/ormolu/pull/1170).++* Correctly format single-line `MultiWayIf`s. [Issue+ 1171](https://github.com/tweag/ormolu/issues/1171).++## Ormolu 0.8.0.0++* Format multiple files in parallel. [Issue+ 1128](https://github.com/tweag/ormolu/issues/1128).++* Fractional precedences are now allowed in `.ormolu` files for more precise+ control over formatting of complex operator chains. [Issue+ 1106](https://github.com/tweag/ormolu/issues/1106).++* Correctly format type applications of `QuasiQuotes`. [Issue+ 1134](https://github.com/tweag/ormolu/issues/1134).++* Correctly format multi-line parentheses in arrow `do` blocks. [Issue+ 1144](https://github.com/tweag/ormolu/issues/1144).++* Switched to `ghc-lib-parser-9.12`, with the following new syntactic features:+ * GHC proposal [#522](https://github.com/ghc-proposals/ghc-proposals/blob/c9401f037cb22d1661931b2ec621925101052997/proposals/0522-or-patterns.rst): `OrPatterns` (enabled by default)+ * GHC proposal [#569](https://github.com/ghc-proposals/ghc-proposals/blob/c9401f037cb22d1661931b2ec621925101052997/proposals/0569-multiline-strings.rst): `MultilineStrings` (disabled by default)+ * GHC proposal [#409](https://github.com/ghc-proposals/ghc-proposals/blob/f79438cf8dbfcd90187f7af3a380515ffe45dbdc/proposals/0409-exportable-named-default.rst): `NamedDefaults` (enabled by default)+ * GHC proposal [#281](https://github.com/ghc-proposals/ghc-proposals/blob/c9401f037cb22d1661931b2ec621925101052997/proposals/0281-visible-forall.rst): accept more types in terms: `forall` quantifications, constraint arrows `=>`, type arrows `->` (enabled by default)+ * Part of GHC proposal [#425](https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0425-decl-invis-binders.rst): wildcard binders (enabled by default)++* Correctly format non-promoted type-level tuples with `NoListTuplePuns`. [Issue+ 1146](https://github.com/tweag/ormolu/issues/1146).++* Updated to `Cabal-syntax-3.14`. [Issue+ 1152](https://github.com/tweag/ormolu/issues/1152).++## Ormolu 0.7.7.0++* Use single-line layout for parens around single-line content. [Issue+ 1120](https://github.com/tweag/ormolu/issues/1120).++* Allow function arguments to be on the same line even if the full type+ (with constraints and foralls) are on multiple lines. [PR+ 1125](https://github.com/tweag/ormolu/pull/1125).++## Ormolu 0.7.6.0++* Fix Haddock comments on infix constructors. [Issue+ 758](https://github.com/tweag/ormolu/issues/758).++* Don't require a trailing newline in `.ormolu` files. [Issue+ 1122](https://github.com/tweag/ormolu/issues/1122).++* Remove unnecessary indentation from list comprehensions. [Issue+ 966](https://github.com/tweag/ormolu/issues/966).++## Ormolu 0.7.5.0++* Switched to `ghc-lib-parser-9.10`, with the following new syntactic features/behaviors:+ * GHC proposal [#575](https://github.com/ghc-proposals/ghc-proposals/blob/10290a668608d608c3f6c6010be265cf7a02e1fc/proposals/0575-deprecated-instances.rst): deprecated instances.+ * GHC proposal [#281](https://github.com/ghc-proposals/ghc-proposals/blob/10290a668608d608c3f6c6010be265cf7a02e1fc/proposals/0281-visible-forall.rst): visible forall in types of terms.+ Enabled by `RequiredTypeArguments` (enabled by default).+ * `LinearTypes`: `let` and `where` bindings can now be linear, in particular have multiplicity annotations.+ * Using `forall` as an identifier is now a parse error.+ * GHC proposal [#65](https://github.com/ghc-proposals/ghc-proposals/blob/10290a668608d608c3f6c6010be265cf7a02e1fc/proposals/0065-type-infix.rst): namespacing fixity declarations for type names and WARNING/DEPRECATED pragmas.+ * `TypeAbstractions` now supports `@`-binders in lambdas and function equations.+ * Support for the `GHC2024` language.++* Updated to `Cabal-syntax-3.12`.++## Ormolu 0.7.4.0++* Don't error when the `JavaScriptFFI` language pragma is present. [Issue+ 1087](https://github.com/tweag/ormolu/issues/1087).+* Improve comment placement in if-then-else blocks. [Issue+ 998](https://github.com/tweag/ormolu/issues/998).+* Now command line options for fixity overrides and module re-exports+ overwrite information from `.ormolu` files. [Issue+ 1030](https://github.com/tweag/ormolu/issues/1030).+* Respect newlines in data declarations in more cases. [Issue+ 1077](https://github.com/tweag/ormolu/issues/1077) and [issue+ 947](https://github.com/tweag/ormolu/issues/947).+* The `-d / --debug` command line option now makes Ormolu print out debug+ information regarding operator fixity inference. [Issue+ 1060](https://github.com/tweag/ormolu/issues/1060).++## Ormolu 0.7.3.0++* Switched to `ghc-lib-parser-9.8`, with the following new syntactic features:+ * `ExtendedLiterals`: `123#Int8` is a literal of type `Int8#`. (disabled by+ default)+ * `TypeAbstractions`: `@k`-binders in data type declarations (enabled by+ default)+ * GHC proposal [#134](https://github.com/ghc-proposals/ghc-proposals/blob/0b652bd70258e354dfe4a05940182007596f8bf7/proposals/0134-deprecating-exports-proposal.rst): deprecating/warning about exports+ * GHC proposal [#541](https://github.com/ghc-proposals/ghc-proposals/blob/0b652bd70258e354dfe4a05940182007596f8bf7/proposals/0541-warning-pragmas-with-categories.rst): warning categories++## Ormolu 0.7.2.0++* Preserve necessary braces for final function arguments. [Issue+ 1044](https://github.com/tweag/ormolu/issues/1044).++* Put `"this"` `PackageImports` at the end. [Issue+ 1048](https://github.com/tweag/ormolu/issues/1048).++* Format parenthesized operators starting with a `#` correctly in the presence+ of `UnboxedSums`. [Issue 1062](https://github.com/tweag/ormolu/issues/1062).++* Fix false positives in AST diffing related to empty Haddock comments in data+ declarations. [Issue 1065](https://github.com/tweag/ormolu/issues/1065).++## Ormolu 0.7.1.0++* Include `base` fixity information when formatting a Haskell file that's+ not mentioned in an existing cabal file. [Issue+ 1032](https://github.com/tweag/ormolu/issues/1032)++* Update `displayException` for `OrmoluException` to pretty print the+ exception. [PR 1031](https://github.com/tweag/ormolu/pull/1031).++* Ormolu is now aware of more common module re-exports by default.++* 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 still be taken into account correctly.+ [Issue 1037](https://github.com/tweag/ormolu/issues/1037).++* Ormolu no longer fails when CPP directly follows the import section (a+ regression introduced in 0.7.0.0). [Issue+ 1040](https://github.com/tweag/ormolu/issues/1040).++## Ormolu 0.7.0.0++* Inference of operator fixity information is now more precise and takes+ into account the import section of the module being formatted. [Issue+ 892](https://github.com/tweag/ormolu/issues/892) and [issue+ 929](https://github.com/tweag/ormolu/issues/929).++* Ormolu can now be made aware of module re-exports through either special+ declarations in `.ormolu` files (see the readme for a description of the+ syntax), or on the command line with the `--reexport`/`-r` option. [Issue+ 1017](https://github.com/tweag/ormolu/issues/1017).++* Ormolu now looks for `.ormolu` files independently of `.cabal` files. This+ means that it is now possible to have one `.ormolu` file for multiple+ Cabal packages. [Issue 1019](https://github.com/tweag/ormolu/issues/1019).++* Consistently format `do` blocks/`case`s/`MultiWayIf`s with 4 spaces if and+ only if they occur as the applicand. [Issue+ 1002](https://github.com/tweag/ormolu/issues/1002) and [issue+ 730](https://github.com/tweag/ormolu/issues/730).++* Support the (deprecated) `DatatypeContexts` extension to avoid surprises.+ [Issue 1012](https://github.com/tweag/ormolu/issues/1012).++* Don't let comments escape from empty export lists. [Issue+ 906](https://github.com/tweag/ormolu/issues/906).++* Format `\cases` with multiple patterns across multiple lines correctly. [Issue+ 1025](https://github.com/tweag/ormolu/issues/1025).++## Ormolu 0.6.0.1++* Fix false positives in AST diffing related to `UnicodeSyntax`. [PR+ 1009](https://github.com/tweag/ormolu/pull/1009).++## Ormolu 0.6.0.0++* Haddocks attached to arguments of a data constructor are now formatted in+ the pipe style (rather than the caret style), consistent with everything+ else. As a consequence, now Ormolu's output will be deemed invalid by the+ Haddock shipped with GHC <9.0. [Issue+ 844](https://github.com/tweag/ormolu/issues/844) and [issue+ 828](https://github.com/tweag/ormolu/issues/828).++* Insert space before char literals in ticked promoted constructs when+ necessary. [Issue 1000](https://github.com/tweag/ormolu/issues/1000).++* Switched to `ghc-lib-parser-9.6`:+ * Extended `OverloadedLabels`: `#Foo`, `#3`, `#"Hello there"`.++ Also, it is now disabled by default, as it causes e.g. `a#b` to be parsed+ differently.+ * New extension: `TypeData`, enabled by default.+ * Parse errors now include error codes, cf. https://errors.haskell.org.++* Updated to `Cabal-syntax-3.10`.++* Now whenever Ormolu fails to parse a `.cabal` file it also explains why.+ [PR 999](https://github.com/tweag/ormolu/pull/999).++## Ormolu 0.5.3.0++* Stop making empty `let`s move comments. [Issue+ 917](https://github.com/tweag/ormolu/issues/917).++* Now `.ormolu` fixity override files can use both LF and CRLF line endings.+ [PR 969](https://github.com/tweag/ormolu/pull/969).++* Normalize parentheses around constraints. [Issue+ 264](https://github.com/tweag/ormolu/issues/264).++* The `ormolu` function now consumes `Text` instead of `String` due to an+ internal refactoring.++* Exposed a more complete public API in the `Ormolu` module. The API is+ supposed to be stable and change according to+ [PVP](https://pvp.haskell.org/).++* Now warnings regarding Ormolu not being able to find `.cabal` files or+ finding such files but them not mentioning the source file in question are+ only displayed when `--debug` is used. Printing the warnings by default+ seems to have been confusing, see e.g. [Issue+ 971](https://github.com/tweag/ormolu/issues/971) and [issue+ 924](https://github.com/tweag/ormolu/issues/924).++## Ormolu 0.5.2.0++* Eliminated the `fixity-th` Cabal flag because it caused issues on GHC 9.4 as+ well as on aarch64. See [issue+ 941](https://github.com/tweag/ormolu/issues/941) and [issue+ 927](https://github.com/tweag/ormolu/issues/927).++* Now operators without explicitly specified fixity default to left+ associativity and highest precedence. [Issue+ 907](https://github.com/tweag/ormolu/issues/907).++## Ormolu 0.5.1.0++* Imports are now sorted by package qualifier, if one is present.+ [Issue 905](https://github.com/tweag/ormolu/issues/905).++* Extension packs like `GHC2021` and `Haskell2010` are now bumped to the top of+ the list of language pragmas. [Issue+ 922](https://github.com/tweag/ormolu/issues/922).++* Fix formatting of `SCC` pragmas in `do` blocks. [Issue+ 925](https://github.com/tweag/ormolu/issues/925).++* Support type applications in patterns. [Issue+ 930](https://github.com/tweag/ormolu/issues/930).++* Handle `UnicodeSyntax` variants more consistently. [Issue+ 934](https://github.com/tweag/ormolu/issues/934).++* Fix an inconsistency in formatting of types in GADT declarations in+ certain cases. [PR 932](https://github.com/tweag/ormolu/pull/932).++* Switched to `ghc-lib-parser-9.4`, which brings support for the following new+ syntactic features:+ * `\cases` via `LambdaCase`+ * `OPAQUE` pragmas+ * Unboxed sum type constructors like `(# | #)`.++* Updated to `Cabal-syntax-3.8`, supporting `cabal-version: 3.8`.++## Ormolu 0.5.0.1++* Fixed a bug in the diff printing functionality. [Issue+ 886](https://github.com/tweag/ormolu/issues/886).++* Indent closing bracket for list comprehensions in `do` blocks.+ [Issue 893](https://github.com/tweag/ormolu/issues/893).++* Fix `hs-source-dirs: .` resulting in failing to find a `.cabal` file for a+ Haskell source file. [Issue 909](https://github.com/tweag/ormolu/issues/909).++* Comments in closed type family declarations are now indented correctly.+ [Issue 913](https://github.com/tweag/ormolu/issues/913).++* Cache `.cabal` file parsing and processing when given multiple input files in+ the same project. This results in dramatic speedups on projects which have+ both huge `.cabal` files and a large number of individual modules. [Issue+ 897](https://github.com/tweag/ormolu/issues/897).++## Ormolu 0.5.0.0++* Changed the way operator fixities and precedences are inferred.+ * Ormolu now tries to locate `.cabal` files of source files by default and+ in addition to default extensions it also infers the list of+ dependencies.+ * Ormolu comes equipped with extensive knowledge of all packages on+ Hackage and operators that those packages define. Knowing the names of+ the dependencies it can select the right fixity and precedence info from+ its knowledge base.+ * You can ask Ormolu not to look for `.cabal` files by using the+ `--no-cabal` switch.+ * Dependencies can be selected manually by using the `-p / --package`+ option (can be repeated many times).+ * The default heuristic algorithm will still try to guess the right+ fixities and precedence.+ * Fixity overrides can be provided by the user in the familiar Haskell+ notation (e.g. `infixr 9 .`, one declaration per line). They are loaded+ by default from the `.ormolu` file that is expected to be in the same+ directory as the `.cabal` file of a given source file. However, if+ `--no-cabal` is supplied, the `.ormolu` file will not be looked for either.+ Fixity declarations can be also provided by using the `-f / --fixity`+ command line option, which see.+ * This resolves the following issues: [Issue+ 826](https://github.com/tweag/ormolu/issues/826), [Issue+ 785](https://github.com/tweag/ormolu/issues/785), [Issue+ 690](https://github.com/tweag/ormolu/issues/690), [Issue+ 825](https://github.com/tweag/ormolu/issues/825).++* Invalid haddock comments are formatted in a more consistent way. Leading+ haddock triggers (`|`, `^`) in an invalid haddock comment block are now+ escaped with a backslash `\`. [Issue+ 816](https://github.com/tweag/ormolu/issues/816).++* Type synonyms and families are now formatted correctly when the equals sign+ is preceded by a comment. [Issue 829](+ https://github.com/tweag/ormolu/issues/829).++* Bidirectional pattern synonyms are formatted nicer in certain cases.+ [Issue 843](https://github.com/tweag/ormolu/issues/843).++* Magic comments (like `{- ORMOLU_DISABLED -}`) now allow arbitrary+ succeeding text. This fixes use cases like [Issue+ 856](https://github.com/tweag/ormolu/issues/856).++* Remove discrepancies between unboxed types and terms. [Issue 856+ ](https://github.com/tweag/ormolu/issues/856).+ * Unboxed sum types are now formatted with a space before each `|`.+ * Unboxed unit tuples on type and value levels are formatted as `(# #)`.++* Errors caused by AST differences now print before/after diffs.+ [Issue 877](https://github.com/tweag/ormolu/issues/877).++* Improved formatting of data declarations in the case of single-constructor+ record with a Haddock. [Issue+ 881](https://github.com/tweag/ormolu/issues/881).++## Ormolu 0.4.0.0++* When a guard is located on its own line, the body associated with this+ guard is indented by one extra level, so that it can easily be+ distinguished from the guard predicate or pattern. [Issue+ 806](https://github.com/tweag/ormolu/issues/806).++* Now a space is forced after `--` in line comments. [Issue+ 808](https://github.com/tweag/ormolu/issues/808).++* Allow formatting Backpack signature files (`.hsig`). The switch between+ regular module mode and signature mode is based on the file extension by+ default, but can be overridden with the `-t / --source-type` command line+ option. [Issue 600](https://github.com/tweag/ormolu/issues/600).++* Blank Haddock comments are now eliminated. This also fixes issues with+ differing ASTs in some special cases. [Issue+ 726](https://github.com/tweag/ormolu/issues/726).++* Rewrite rules that are never active are now formatted correctly.+ [Issue 823](https://github.com/tweag/ormolu/issues/823).++* Promoted infix data constructors are now formatted correctly. [Issue 768](+ https://github.com/tweag/ormolu/issues/768).++* Switched to `ghc-lib-parser-9.2`.+ [Issue 794](https://github.com/tweag/ormolu/issues/794).+ * Support for the new syntax-related language extensions:+ `OverloadedRecordDot` and `OverloadedRecordUpdate`+ (disabled by default).+ [Issue 709](https://github.com/tweag/ormolu/issues/709).+ * Removed support for `record-dot-preprocessor`. For the getter syntax,+ consider using `OverloadedRecordDot` instead. [Issue+ 659](https://github.com/tweag/ormolu/issues/659). [Issue+ 705](https://github.com/tweag/ormolu/issues/705).+ * Support for the `GHC2021` language.++## Ormolu 0.3.1.0++* Allow check mode when working with stdin input. [Issue 634](+ https://github.com/tweag/ormolu/issues/634).++* Now guards are printed on a new line if at least one guard is multiline or+ if all guards together occupy more than one line. The body of each guard+ is also indented one level deeper in that case. [Issue+ 712](https://github.com/tweag/ormolu/issues/712).++* Invalid Haddock comments are no longer silently deleted, but rather converted+ into regular comments. [Issue 474](https://github.com/tweag/ormolu/issues/474).++## Ormolu 0.3.0.1++* Improvements to `.cabal` file handling:+ * When looking for a `.cabal` file, directories were previously+ erroneously also considered. [Issue 781](+ https://github.com/tweag/ormolu/issues/781).+ * We now print a note if Ormolu was told to consider+ `.cabal` files, but no suitable one could be found.+ * Handle an empty `hs-source-dirs` correctly.+ * Also consider modules which are only conditionally listed+ in the `.cabal` file.++* The special handling of CPP is now only applied if CPP is+ actually enabled. [Issue 782](https://github.com/tweag/ormolu/issues/782).++* The left hand side of the `:` operator now uses braces if+ necessary. [Issue 780](https://github.com/tweag/ormolu/issues/780).++## Ormolu 0.3.0.0++* Data declarations with multiline kind signatures are now formatted+ correctly. [Issue 749](https://github.com/tweag/ormolu/issues/749).++* Infix arrow command formations are formatted like usual operators.+ This fixes [Issue 748](https://github.com/tweag/ormolu/issues/748).++* `do` arrow commands are formatted more flexibly. Fixes [Issue+ 753](https://github.com/tweag/ormolu/issues/753).++* Source code is always read and written using UTF8 and ignoring the native+ line ending conventions. [Issue+ 717](https://github.com/tweag/ormolu/issues/717).++* Opt-in support to respect default-extensions and default-language+ from .cabal files. [Issue 517](https://github.com/tweag/ormolu/issues/517).++* Empty case expressions are now rendered with braces. [Issue+ 765](https://github.com/tweag/ormolu/issues/765).++* Omit braces on repeated application of `do` blocks. [Issue+ 735](https://github.com/tweag/ormolu/issues/735).++* Improved handling of disabled regions. [PR 773](+ https://github.com/tweag/ormolu/pull/773).+ * Disabled regions are now exactly preserved, in particular+ empty lines and trailing spaces. [Issue+ 673](https://github.com/tweag/ormolu/issues/673).+ * Strings like `-}` can now be present in disabled regions.+ [Issue 708](https://github.com/tweag/ormolu/issues/708).++ This means that using CPP or magic comments in certain ways which+ were only supported as a side effect previously (like in+ [Issue 601](https://github.com/tweag/ormolu/issues/601))+ will now result in formatting failures. Also see [Issue 774](+ https://github.com/tweag/ormolu/issues/774).+ ## Ormolu 0.2.0.0 * Now standalone kind signatures are grouped with type synonyms. [Issue@@ -54,7 +541,7 @@ Previously, if an extension was disabled via the CLI, it could not be re-enabled per file. -* `LexicalNegation` is no longer enabled by default. Also, spaces after+* `NegativeLiterals` is no longer enabled by default. Also, spaces after negation via `-` are removed where possible. [Issue 694](https://github.com/tweag/ormolu/issues/694). @@ -64,7 +551,8 @@ * Added support for left-to-right arrow application. [Issue 737](https://github.com/tweag/ormolu/issues/737). -* Now `--mode check` fails on missing trailing blank lines.+* Now `--mode check` fails on missing trailing blank lines. [Issue+ 743](https://github.com/tweag/ormolu/issues/743). * Fixed indentation of arrow forms in do blocks. [Issue 739](https://github.com/tweag/ormolu/issues/739).
@@ -13,11 +13,7 @@ Please make sure that all non-trivial changes are described in commit messages and PR descriptions. -## What to hack on?--* [Fixing bugs][bugs]. This is the main focus right now.--### Testing+## Testing Testing has been taken good care of and now it amounts to just adding examples under `data/examples`. Each example is a pair of files:@@ -39,26 +35,18 @@ Please note that we try to keep individual files at most 25 lines long because otherwise it's hard to figure out want went wrong when a test fails. -## CI--We use Circle CI. Some outside contributors may have problems, as in, CI-won't run for PRs opened from forks with “unauthorized” errors. In that case-the best we can do is to add you as a contributor or to restart your build-manually.--If you have been added as a contributor but the builds still do not start,-try clicking+To regenerate outputs that have changed, you can set the+`ORMOLU_REGENERATE_EXAMPLES` environment variable before running tests. -```-User settings -> Account integrations -> Refresh permissions-```+## Formatting -in Circle CI app.+ - Use `nix run .#format` script to format Ormolu with the current version of+ Ormolu. -## Formatting+ - Additional formatters are configured via a pre-commit hook which is+ automatically installed when entering the Nix shell. You can also run it via+ `pre-commit run`/`pre-commit run -a`. -Use `format.sh` script to format Ormolu with current version of Ormolu. If-Ormolu is not formatted like this, the CI will fail.+If Ormolu is not formatted like this, the CI will fail. [issues]: https://github.com/tweag/ormolu/issues-[bugs]: https://github.com/tweag/ormolu/issues?q=is%3Aissue+is%3Aopen+label%3Abug
@@ -65,7 +65,7 @@ of which fit in linear space. So care is necessary to keep memory bounded. -The compexities of the `BriDoc` structure, together with the lack of+The complexities of the `BriDoc` structure, together with the lack of documentation, make Brittany at least challenging to maintain. ### Hindent@@ -107,13 +107,13 @@ from the same upstream problems. I haven't studied the transformations it performs, but it looks like it transforms the parsed source code partially by manipulating AST and partially by manipulating raw text (e.g. to drop-trailing whitspace from each line). CPP Macros are just filtered out+trailing whitespace from each line). CPP Macros are just filtered out silently as a preprocessing step before feeding the code to `haskell-src-exts`. Stylish Haskell is not so invasive as the other formatters and most reported bugs are about parsing issues and CPP. As I understand it, people mostly use-it to screw their import lists.+it to sort their import lists. ### Haskell formatter @@ -225,7 +225,7 @@ directives, constraining how directives can be inserted in Haskell code to avoid changing the meaning by reformatting. But this would introduce additional complexity, and the problem would-need to be solved repeteadly for every tool out there which wants+need to be solved repeatedly for every tool out there which wants to parse Haskell modules. If CPP is replaced with some language extension or mechanism to do conditional compilation, all tools will benefit from it.@@ -366,7 +366,7 @@ * An option to specify location of config file. * Options to specify parameters that come from config files on command line instead (currently this is just dynamic options enabled by default, such- as langauge extensions).+ as language extensions). ### Why not contribute to/fork HIndent or Brittany? @@ -386,7 +386,7 @@ Forking or contributing to Hindent is not an option because if we replace `haskell-src-exts` with `ghc` (or `ghc-exact-print`) then we'll have to work with a different AST type and all the code in Hindent will become-incompatible and there won't be much code to be re-used in that case. It is+incompatible and there won't be much code to be reused in that case. It is also possible that we'll find a nicer way to write pretty-printer. ## Examples
@@ -4,17 +4,25 @@ [](https://hackage.haskell.org/package/ormolu) [](http://stackage.org/nightly/package/ormolu) [](http://stackage.org/lts/package/ormolu)-[](https://buildkite.com/tweag-1/ormolu)+[](https://github.com/tweag/ormolu/actions/workflows/ci.yml) -* [Building and installation](#building-and-installation)- * [Arch Linux](#arch-linux)+* [Installation](#installation)+* [Building from source](#building-from-source) * [Usage](#usage)+ * [Ormolu Live](#ormolu-live) * [Editor integration](#editor-integration)+ * [Haskell Language Server](#haskell-language-server) * [GitHub actions](#github-actions)+ * [Language extensions, dependencies, and fixities](#language-extensions-dependencies-and-fixities) * [Magic comments](#magic-comments)+ * [Regions](#regions) * [Exit codes](#exit-codes)+ * [Using as a library](#using-as-a-library)+* [Troubleshooting](#troubleshooting)+ * [Operators are being formatted weirdly!](#operators-are-being-formatted-weirdly) * [Limitations](#limitations) * [Running on Hackage](#running-on-hackage)+* [Forks and modifications](#forks-and-modifications) * [Contributing](#contributing) * [License](#license) @@ -38,64 +46,56 @@ * Be well-tested and robust so that the formatter can be used in large projects. -## Building and installation+Try it out in your browser at <https://ormolu-live.tweag.io>!+See [Ormolu Live](#ormolu-live) for more info. -The easiest way to build the project is with Nix:+## Installation +The [release page][releases] has binaries for Linux, macOS and Windows.++You can also install using `cabal` or `stack`:+ ```console-$ nix-build -A ormolu+$ cabal install ormolu+$ stack install ormolu ``` -Or with `cabal-install` from the Nix shell:+Ormolu is also included in several package repositories. E.g., on Arch Linux,+one can use [the package on AUR][aur]: ```console-$ nix-shell --run "cabal new-build"+$ yay -S ormolu ``` -Alternatively, `stack` could be used with a `stack.yaml` file as follows.+## Building from source +The easiest way to build the project is with Nix:+ ```console-$ cat stack.yaml-resolver: lts-16.0-packages:-- '.'+$ nix build+``` +Make sure to accept the offered Nix caches (in particular the IOG cache),+otherwise building may take a very long time.++Alternatively, `stack` could be used as follows:++```console $ stack build # to build $ stack install # to install ``` -To use Ormolu directly from GitHub with Nix, this snippet may come in handy:+To use Ormolu directly from GitHub with Nix flakes, this snippet may come in handy: ```nix-# This overlay adds Ormolu straight from GitHub.-self: super:--let source = super.fetchFromGitHub {- owner = "tweag";- repo = "ormolu";- rev = "de279d80122b287374d4ed87c7b630db1f157642"; # update as necessary- sha256 = "0qrxfk62ww6b60ha9sqcgl4nb2n5fhf66a65wszjngwkybwlzmrv"; # same- };- ormolu = import source { pkgs = self; };-in {- haskell = super.haskell // {- packages = super.haskell.packages // {- "${ormolu.ormoluCompiler}" = super.haskell.packages.${ormolu.ormoluCompiler}.override {- overrides = ormolu.ormoluOverlay;- };- };+{+ inputs.ormolu.url = "github:tweag/ormolu";+ outputs = { ormolu, ... }: {+ # use ormolu.packages.${system}.default here }; } ``` -### Arch Linux--To install Ormolu on Arch Linux, one can use [the package on AUR][aur]:--```console-yay -S ormolu-```- ## Usage The following will print the formatted output to the standard output.@@ -129,6 +129,20 @@ $ ormolu --mode check $(find . -name '*.hs') ``` +#### :zap: Beware git's `core.autocrlf` on Windows :zap:+Ormolu's output always uses LF line endings. In particular,+`ormolu --mode check` will fail if its input is correctly formatted+*except* that it has CRLF line endings. This situation can happen on Windows+when checking out a git repository without having set [`core.autocrlf`](+https://www.git-scm.com/docs/git-config#Documentation/git-config.txt-coreautocrlf)+to `false`.++### Ormolu Live++On every new commit to `master`, [Ormolu Live](./ormolu-live) is deployed to+https://ormolu-live.tweag.io. Older versions are available at+https://COMMITHASH--ormolu-live.netlify.app.+ ### Editor integration We know of the following editor integrations:@@ -137,11 +151,81 @@ * [VS Code][vs-code-plugin] * Vim: [neoformat][neoformat], [vim-ormolu][vim-ormolu] +### Haskell Language Server++[Haskell Language Server](https://haskell-language-server.readthedocs.io)+has built-in support for using Ormolu as a formatter.+ ### GitHub actions -[`ormolu-action`][ormolu-action] is the recommended way to ensure that a-project is formatted with Ormolu.+[`run-ormolu`][run-ormolu] is the recommended way to ensure that a project+is formatted with Ormolu. +### Language extensions, dependencies, and fixities++Ormolu automatically locates the Cabal file that corresponds to a given+source code file. Cabal files are used to extract both default extensions+and dependencies. Default extensions directly affect behavior of the GHC+parser, while dependencies are used to figure out fixities of operators that+appear in the source code. Fixities can also be overridden via an `.ormolu`+file which should be located at a higher level in the file system hierarchy+than the source file that is being formatted. When the input comes from+stdin, one can pass `--stdin-input-file` which will give Ormolu the location+that should be used as the starting point for searching for `.cabal` and+`.ormolu` files.++Here is an example of `.ormolu` file:++```haskell+infixr 9 .+infixr 5 +++infixl 4 <$+infixl 1 >>, >>=+infixr 1 =<<+infixr 0 $, $!+infixl 4 <*>, <*, *>, <**>++infixr 3 >~<+infixr 3.3 |~|+infixr 3.7 <~>+```++It uses exactly the same syntax as usual Haskell fixity declarations to make+it easier for Haskellers to edit and maintain. Since Ormolu 0.7.8.0+fractional precedences are supported for more precise control over+formatting of complex operator chains.++As of Ormolu 0.7.0.0, `.ormolu` files can also contain instructions about+module re-exports that Ormolu should be aware of. This might be desirable+because at the moment Ormolu cannot know about all possible module+re-exports in the ecosystem and only few of them are actually important when+it comes to fixity deduction. In 99% of cases the user won't have to do+anything, especially since most common re-exports are already programmed+into Ormolu. (You are welcome to open PRs to make Ormolu aware of more+re-exports by default.) However, when the fixity of an operator is not+inferred correctly, making Ormolu aware of a re-export may come in handy.+Here is an example:++```haskell+module Control.Lens exports Control.Lens.At+module Control.Lens exports "lens" Control.Lens.Lens+```++Module re-export declarations can be mixed freely with fixity overrides, as+long as each declaration is on its own line. As of Ormolu 0.7.1.0 explicit+package names are allowed in re-export declarations (see the example above).++Finally, all of the above-mentioned parameters can be controlled from the+command line:++* Language extensions can be specified with the `-o` or `--ghc-opt` flag.+* Dependencies can be specified with the `-p` or `--package` flag.+* Fixities can be specified with the `-f` or `--fixity` flag.+* Re-exports can be specified with the `-r` or `--reexport` flag.++Searching for `.cabal` and `.ormolu` files can be disabled by passing+`--no-cabal` and `--no-dot-ormolu` respectively.+ ### Magic comments Ormolu understands two magic comments:@@ -159,10 +243,19 @@ This allows us to disable formatting selectively for code between these markers or disable it for the entire file. To achieve the latter, just put `{- ORMOLU_DISABLE -}` at the very top. Note that for Ormolu to work the-source code must still be parseable even when the disabled regions are-omitted. Because of that the magic comments cannot be placed arbitrarily,-but rather must enclose independent top-level definitions.+fragments where Ormolu is enabled must be parseable on their own. Because of+that the magic comments cannot be placed arbitrarily, but rather must+enclose independent top-level definitions. +### Regions++One can ask Ormolu to format a region of input and leave the rest+unformatted. This is accomplished by passing the `--start-line` and+`--end-line` command line options. `--start-line` defaults to the beginning+of the file, while `--end-line` defaults to the end.++Note that the selected region needs to be parseable Haskell code on its own.+ ### Exit codes Exit code | Meaning@@ -175,10 +268,46 @@ 5 | AST of original and formatted code differs 6 | Formatting is not idempotent 7 | Unrecognized GHC options+8 | Cabal file parsing failed+9 | Missing input file path when using stdin input and accounting for .cabal files+10 | Parse error while parsing fixity overrides 100 | In checking mode: unformatted files-101 | Inplace and check modes do not work with stdin+101 | Inplace mode does not work with stdin 102 | Other issue (with multiple input files) +### Using as a library++The `ormolu` package can also be depended upon from other Haskell programs.+For these purposes only the top `Ormolu` module should be considered stable.+It follows [PVP](https://pvp.haskell.org/) starting from the version+0.5.3.0. Rely on other modules at your own risk.++## Troubleshooting++### Operators are being formatted weirdly!++This can happen when Ormolu doesn't know or can't determine the fixity of an+operator.++* If this is a custom operator, see the instructions in the [Language+ extensions, dependencies, and+ fixities](#language-extensions-dependencies-and-fixities) section to+ specify the correct fixities in a `.ormolu` file.++* If this is a third-party operator (e.g. from `base` or some other package+ from Hackage), Ormolu probably doesn't recognize that the operator is the+ same as the third-party one.++ Some reasons this might be the case:++ * You might have a custom Prelude that re-exports things from Prelude+ * You might have `-XNoImplicitPrelude` turned on++ If any of these are true, make sure to specify the reexports correctly in+ a `.ormolu` file.++You can see how Ormolu decides the fixity of operators if you use `--debug`.+ ## Limitations * CPP support is experimental. CPP is virtually impossible to handle@@ -186,8 +315,6 @@ works only in simple cases when CPP conditionals surround top-level declarations. See the [CPP][design-cpp] section in the design notes for a discussion of the dangers.-* Input modules should be parsable by Haddock, which is a bit stricter- criterion than just being valid Haskell modules. ## Running on Hackage @@ -195,7 +322,7 @@ execute (from the root of the cloned repo): ```console-$ nix-build -A hackage.<package>+$ nix build .#hackage.<package> ``` Then inspect `result/log.txt` for possible problems. The derivation will@@ -203,6 +330,13 @@ `.hs-original` extension (those are with CPP dropped, exactly what is fed into Ormolu). +## Forks and modifications++We know of the following actively maintained forks:++* [Fourmolu][fourmolu], which uses 4-space indentation and allows arbitrary+ configuration.+ ## Contributing See [CONTRIBUTING.md][contributing].@@ -214,12 +348,14 @@ Copyright © 2018–present Tweag I/O [aur]: https://aur.archlinux.org/packages/ormolu-[contributing]: https://github.com/tweag/ormolu/blob/master/CONTRIBUTING.md [design-cpp]: https://github.com/tweag/ormolu/blob/master/DESIGN.md#cpp [emacs-package]: https://github.com/vyorkin/ormolu.el [haskell-src-exts]: https://hackage.haskell.org/package/haskell-src-exts-[license]: https://github.com/tweag/ormolu/blob/master/LICENSE.md [neoformat]: https://github.com/sbdchd/neoformat-[ormolu-action]: https://github.com/marketplace/actions/ormolu-action+[releases]: https://github.com/tweag/ormolu/releases+[run-ormolu]: https://github.com/haskell-actions/run-ormolu [vim-ormolu]: https://github.com/sdiehl/vim-ormolu [vs-code-plugin]: https://marketplace.visualstudio.com/items?itemName=sjurmillidahl.ormolu-vscode+[fourmolu]: https://github.com/fourmolu/fourmolu+[contributing]: https://github.com/tweag/ormolu/blob/master/CONTRIBUTING.md+[license]: https://github.com/tweag/ormolu/blob/master/LICENSE.md
@@ -1,6 +0,0 @@-module Main (main) where--import Distribution.Simple--main :: IO ()-main = defaultMain
@@ -1,34 +1,55 @@ {-# LANGUAGE CPP #-}+{-# LANGUAGE DataKinds #-} {-# LANGUAGE LambdaCase #-}+{-# LANGUAGE QuasiQuotes #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TemplateHaskell #-}-{-# LANGUAGE TypeApplications #-} module Main (main) where +import Control.Concurrent (MVar, newMVar, withMVar)+import Control.Exception (throwIO) import Control.Monad import Data.Bool (bool) import Data.List (intercalate, sort)-import Data.Maybe (mapMaybe)-import qualified Data.Text.IO as TIO+import Data.List.NonEmpty (NonEmpty)+import Data.Map.Strict qualified as Map+import Data.Maybe (fromMaybe, mapMaybe, maybeToList)+import Data.Set qualified as Set+import Data.Text.IO.Utf8 qualified as T.Utf8 import Data.Version (showVersion)-import Development.GitRev+import Distribution.ModuleName (ModuleName)+import Distribution.Types.PackageName (PackageName)+import Language.Haskell.TH.Env (envQ) import Options.Applicative import Ormolu import Ormolu.Diff.Text (diffText, printTextDiff)+import Ormolu.Fixity import Ormolu.Parser (manualExts) import Ormolu.Terminal import Ormolu.Utils (showOutputable)+import Ormolu.Utils.Fixity import Paths_ormolu (version)+import System.Directory import System.Exit (ExitCode (..), exitWith)-import qualified System.FilePath as FP+import System.FilePath qualified as FP import System.IO (hPutStrLn, stderr)+import UnliftIO.Async (pooledMapConcurrently) -- | Entry point of the program. main :: IO () main = do Opts {..} <- execParser optsParserInfo- let formatOne' = formatOne optMode optConfig+ -- We use this to guard writes to stdout in order to avoid+ -- garbled output from concurrent formatting processes.+ outputLock <- newMVar ()+ let formatOne' =+ formatOne+ optConfigFileOpts+ optMode+ optSourceType+ optConfig+ outputLock exitCode <- case optInputFiles of [] -> formatOne' Nothing ["-"] -> formatOne' Nothing@@ -38,7 +59,8 @@ ExitSuccess -> Nothing ExitFailure n -> Just n errorCodes <-- mapMaybe selectFailure <$> mapM (formatOne' . Just) (sort xs)+ mapMaybe selectFailure+ <$> pooledMapConcurrently (formatOne' . Just) (sort xs) return $ if null errorCodes then ExitSuccess@@ -51,59 +73,149 @@ -- | Format a single input. formatOne ::+ -- | How to use .cabal files+ ConfigFileOpts -> -- | Mode of operation Mode ->+ -- | The 'SourceType' requested by the user+ Maybe SourceType -> -- | Configuration Config RegionIndices ->+ -- | Lock for writing to output handles+ MVar () -> -- | File to format or stdin as 'Nothing' Maybe FilePath -> IO ExitCode-formatOne mode config mpath = withPrettyOrmoluExceptions (cfgColorMode config) $- case FP.normalise <$> mpath of- Nothing -> do- r <- ormoluStdin config- case mode of- Stdout -> do- TIO.putStr r- return ExitSuccess- _ -> do- hPutStrLn- stderr- "This feature is not supported when input comes from stdin."- -- 101 is different from all the other exit codes we already use.- return (ExitFailure 101)- Just inputFile -> do- originalInput <- TIO.readFile inputFile- formattedInput <- ormoluFile config inputFile- case mode of- Stdout -> do- TIO.putStr formattedInput- return ExitSuccess- InPlace -> do- -- Only write when the contents have changed, in order to avoid- -- updating the modified timestamp if the file was already correctly- -- formatted.- when (formattedInput /= originalInput) $- TIO.writeFile inputFile formattedInput- return ExitSuccess- Check ->- case diffText originalInput formattedInput inputFile of- Nothing -> return ExitSuccess- Just diff -> do- runTerm (printTextDiff diff) (cfgColorMode config) stderr- -- 100 is different to all the other exit code that are emitted- -- either from an 'OrmoluException' or from 'error' and- -- 'notImplemented'.- return (ExitFailure 100)+formatOne ConfigFileOpts {..} mode reqSourceType rawConfig outputLock mpath =+ withPrettyOrmoluExceptions (cfgColorMode rawConfig) $ do+ let getCabalInfoForSourceFile' sourceFile = do+ cabalSearchResult <- getCabalInfoForSourceFile sourceFile+ let debugEnabled = cfgDebug rawConfig+ case cabalSearchResult of+ CabalNotFound -> do+ when debugEnabled $+ withMVar outputLock $ \_ ->+ hPutStrLn stderr $+ "Could not find a .cabal file for " <> sourceFile+ return Nothing+ CabalDidNotMention cabalInfo -> do+ when debugEnabled $ do+ relativeCabalFile <-+ makeRelativeToCurrentDirectory (ciCabalFilePath cabalInfo)+ withMVar outputLock $ \_ ->+ hPutStrLn stderr $+ "Found .cabal file "+ <> relativeCabalFile+ <> ", but it did not mention "+ <> sourceFile+ return (Just cabalInfo)+ CabalFound cabalInfo -> return (Just cabalInfo)+ getDotOrmoluForSourceFile' sourceFile = do+ if optDoNotUseDotOrmolu+ then return Nothing+ else Just <$> getDotOrmoluForSourceFile sourceFile+ case FP.normalise <$> mpath of+ -- input source = STDIN+ Nothing -> do+ mcabalInfo <- case (optStdinInputFile, optDoNotUseCabal) of+ (_, True) -> return Nothing+ (Nothing, False) -> throwIO OrmoluMissingStdinInputFile+ (Just inputFile, False) -> getCabalInfoForSourceFile' inputFile+ mdotOrmolu <- case optStdinInputFile of+ Nothing -> return Nothing+ Just inputFile -> getDotOrmoluForSourceFile' inputFile+ config <- patchConfig Nothing mcabalInfo mdotOrmolu+ case mode of+ Stdout -> do+ output <- ormoluStdin config+ withMVar outputLock $ \_ ->+ T.Utf8.putStr output+ return ExitSuccess+ InPlace -> do+ hPutStrLn+ stderr+ "In place editing is not supported when input comes from stdin."+ -- 101 is different from all the other exit codes we already use.+ return (ExitFailure 101)+ Check -> do+ -- ormoluStdin is not used because we need the originalInput+ originalInput <- T.Utf8.getContents+ let stdinRepr = "<stdin>"+ formattedInput <-+ ormolu config stdinRepr originalInput+ handleDiff originalInput formattedInput stdinRepr+ -- input source = a file+ Just inputFile -> do+ mcabalInfo <-+ if optDoNotUseCabal+ then return Nothing+ else getCabalInfoForSourceFile' inputFile+ mdotOrmolu <- getDotOrmoluForSourceFile' inputFile+ config <-+ patchConfig+ (Just (detectSourceType inputFile))+ mcabalInfo+ mdotOrmolu+ case mode of+ Stdout -> do+ output <- ormoluFile config inputFile+ withMVar outputLock $ \_ ->+ T.Utf8.putStr output+ return ExitSuccess+ InPlace -> do+ -- ormoluFile is not used because we need originalInput+ originalInput <- T.Utf8.readFile inputFile+ formattedInput <-+ ormolu config inputFile originalInput+ when (formattedInput /= originalInput) $+ T.Utf8.writeFile inputFile formattedInput+ return ExitSuccess+ Check -> do+ -- ormoluFile is not used because we need originalInput+ originalInput <- T.Utf8.readFile inputFile+ formattedInput <-+ ormolu config inputFile originalInput+ handleDiff originalInput formattedInput inputFile+ where+ patchConfig mdetectedSourceType mcabalInfo mdotOrmolu = do+ let sourceType =+ fromMaybe+ ModuleSource+ (reqSourceType <|> mdetectedSourceType)+ return $+ refineConfig+ sourceType+ mcabalInfo+ (Just (cfgFixityOverrides rawConfig))+ (Just (cfgModuleReexports rawConfig))+ ( rawConfig+ { cfgFixityOverrides = maybe defaultFixityOverrides fst mdotOrmolu,+ cfgModuleReexports = maybe defaultModuleReexports snd mdotOrmolu+ }+ )+ handleDiff originalInput formattedInput fileRepr =+ case diffText originalInput formattedInput fileRepr of+ Nothing -> return ExitSuccess+ Just diff -> do+ runTerm (printTextDiff diff) (cfgColorMode rawConfig) stderr+ -- 100 is different to all the other exit code that are emitted+ -- either from an 'OrmoluException' or from 'error' and+ -- 'notImplemented'.+ return (ExitFailure 100) ---------------------------------------------------------------------------- -- Command line options parsing +-- | All command line options. data Opts = Opts { -- | Mode of operation optMode :: !Mode, -- | Ormolu 'Config' optConfig :: !(Config RegionIndices),+ -- | Options related to info extracted from files+ optConfigFileOpts :: ConfigFileOpts,+ -- | Source type option, where 'Nothing' means autodetection+ optSourceType :: !(Maybe SourceType), -- | Haskell source files to format or stdin (when the list is empty) optInputFiles :: ![FilePath] }@@ -119,6 +231,18 @@ Check deriving (Eq, Show) +-- | Options related to configuration stored in the file system.+data ConfigFileOpts = ConfigFileOpts+ { -- | DO NOT extract default-extensions and dependencies from .cabal files+ optDoNotUseCabal :: Bool,+ -- | DO NOT look for @.ormolu@ files+ optDoNotUseDotOrmolu :: Bool,+ -- | Optional path to a file which will be used to find a .cabal file+ -- when using input from stdin+ optStdinInputFile :: Maybe FilePath+ }+ deriving (Show)+ optsParserInfo :: ParserInfo Opts optsParserInfo = info (helper <*> ver <*> exts <*> optsParser) . mconcat $@@ -134,12 +258,9 @@ verStr = intercalate "\n"- [ unwords- [ "ormolu",- showVersion version,- $gitBranch,- $gitHash- ],+ [ unwords $+ ["ormolu", showVersion version]+ <> maybeToList $$(envQ @String "ORMOLU_REV"), "using ghc-lib-parser " ++ VERSION_ghc_lib_parser ] exts :: Parser (a -> a)@@ -166,11 +287,29 @@ ] ) <*> configParser+ <*> configFileOptsParser+ <*> sourceTypeParser <*> (many . strArgument . mconcat) [ metavar "FILE", help "Haskell source files to format or stdin (the default)" ] +configFileOptsParser :: Parser ConfigFileOpts+configFileOptsParser =+ ConfigFileOpts+ <$> (switch . mconcat)+ [ long "no-cabal",+ help "Do not extract default-extensions and dependencies from .cabal files"+ ]+ <*> (switch . mconcat)+ [ long "no-dot-ormolu",+ help "Do not look for .ormolu files"+ ]+ <*> (optional . strOption . mconcat)+ [ long "stdin-input-file",+ help "Path which will be used to find the .cabal file when using input from stdin"+ ]+ configParser :: Parser (Config RegionIndices) configParser = Config@@ -180,6 +319,32 @@ metavar "OPT", help "GHC options to enable (e.g. language extensions)" ]+ <*> ( fmap (FixityOverrides . Map.fromList . mconcat)+ . many+ . option parseFixityDeclaration+ . mconcat+ )+ [ long "fixity",+ short 'f',+ metavar "FIXITY",+ help "Fixity declaration to use (an override)"+ ]+ <*> ( fmap (ModuleReexports . Map.fromListWith (<>) . mconcat . pure)+ . many+ . option parseModuleReexportDeclaration+ . mconcat+ )+ [ long "reexport",+ short 'r',+ metavar "REEXPORT",+ help "Module re-export that Ormolu should know about"+ ]+ <*> (fmap Set.fromList . many . strOption . mconcat)+ [ long "package",+ short 'p',+ metavar "PACKAGE",+ help "Explicitly specified dependency (for operator fixity/precedence only)"+ ] <*> (switch . mconcat) [ long "unsafe", short 'u',@@ -195,6 +360,10 @@ short 'c', help "Fail if formatting is not idempotent" ]+ -- We cannot parse the source type here, because we might need to do+ -- autodetection based on the input file extension (not available here)+ -- before storing the resolved value in the config struct.+ <*> pure ModuleSource <*> (option parseColorMode . mconcat) [ long "color", metavar "WHEN",@@ -214,6 +383,16 @@ ] ) +sourceTypeParser :: Parser (Maybe SourceType)+sourceTypeParser =+ (option parseSourceType . mconcat)+ [ long "source-type",+ short 't',+ metavar "TYPE",+ value Nothing,+ help "Set the type of source; TYPE can be 'module', 'sig', or 'auto' (the default)"+ ]+ ---------------------------------------------------------------------------- -- Helpers @@ -225,9 +404,28 @@ "check" -> Right Check s -> Left $ "unknown mode: " ++ s +-- | Parse a fixity declaration.+parseFixityDeclaration :: ReadM [(OpName, FixityInfo)]+parseFixityDeclaration = eitherReader parseFixityDeclarationStr++-- | Parse a module reexport declaration.+parseModuleReexportDeclaration ::+ ReadM (ModuleName, NonEmpty (Maybe PackageName, ModuleName))+parseModuleReexportDeclaration = eitherReader parseModuleReexportDeclarationStr++-- | Parse 'ColorMode'. parseColorMode :: ReadM ColorMode parseColorMode = eitherReader $ \case "never" -> Right Never "always" -> Right Always "auto" -> Right Auto s -> Left $ "unknown color mode: " ++ s++-- | Parse the 'SourceType'. 'Nothing' means that autodetection based on+-- file extension is requested.+parseSourceType :: ReadM (Maybe SourceType)+parseSourceType = eitherReader $ \case+ "module" -> Right (Just ModuleSource)+ "sig" -> Right (Just SignatureSource)+ "auto" -> Right Nothing+ s -> Left $ "unknown source type: " ++ s
@@ -0,0 +1,3 @@+module Foo where++import Data.List qualified as List
@@ -0,0 +1,3 @@+module Foo where++import Data.List qualified as List
@@ -0,0 +1,13 @@+cabal-version: 2.4+name: test+version: 0++library+ exposed-modules: Foo+ hs-source-dirs: .+ default-extensions: ImportQualifiedPost++executable app+ main-is: Main+ other-modules: Bar+ default-extensions: ImportQualifiedPost
@@ -0,0 +1,8 @@+testPermParser :: Permutation Parser String+testPermParser =+ f+ <$> toPermutationWithDefault 'x' (char 'a')+ <*> toPermutationWithDefault 'y' (char 'b')+ <*> toPermutationWithDefault 'z' (char 'c')+ where+ f a b c = [a, b, c]
@@ -0,0 +1,7 @@+testPermParser :: Permutation Parser String+testPermParser =+ f <$> toPermutationWithDefault 'x' (char 'a')+ <*> toPermutationWithDefault 'y' (char 'b')+ <*> toPermutationWithDefault 'z' (char 'c')+ where+ f a b c = [a, b, c]
@@ -0,0 +1,16 @@+module Main (foo) where++a+b+c++main :: IO ()+main = return ()++d+e+f+g++foo :: Int+foo = 6
@@ -0,0 +1,16 @@+module Main (main) where++a+b+c++main :: IO ()+main = return ()++d+e+f+g++foo :: Int+foo = 5
@@ -1,6 +1,7 @@ TEST-@@ -1,3 +1,3 @@+@@ -1,4 +1,4 @@ - module Main (foo) where + module Main (main) where+ main :: IO () main = return ()
@@ -1,9 +1,10 @@ TEST-@@ -1,6 +1,6 @@+@@ -1,7 +1,7 @@ module Main (main) where main :: IO () - main = return () + main = pure ()+ foo :: Int foo = 5
@@ -0,0 +1,10 @@+TEST+@@ -1,6 +1,7 @@+ testPermParser :: Permutation Parser String+ testPermParser =+- f <$> toPermutationWithDefault 'x' (char 'a')++ f++ <$> toPermutationWithDefault 'x' (char 'a')+ <*> toPermutationWithDefault 'y' (char 'b')+ <*> toPermutationWithDefault 'z' (char 'c')+ where
@@ -0,0 +1,13 @@+TEST+@@ -1,4 +1,4 @@+- module Main (main) where++ module Main (foo) where++ a+ b+@@ -13,4 +13,4 @@+ g++ foo :: Int+- foo = 5++ foo = 6
@@ -14,9 +14,7 @@ ( Read a, Semigroup a ) =>- a ->- a ->- a+ a -> a -> a -- Even more pointless comment bar a
@@ -4,5 +4,5 @@ class Foo a where -- | Foo foo :: a -> String- default foo :: Show a => a -> String+ default foo :: (Show a) => a -> String foo = show
@@ -1,6 +1,6 @@ class Foo a -class Foo a => Bar a+class (Foo a) => Bar a class (Foo a, Bar a) =>
@@ -0,0 +1,1 @@+data {-# CTYPE "unistd.h" "useconds_t" #-} T
@@ -0,0 +1,1 @@+data {-# CTYPE "unistd.h" "useconds_t" #-} T
@@ -0,0 +1,6 @@+data+ {-# CTYPE "header.h" "an-ffi-type-with-along-name" #-}+ AnFFITypeWithAlongName = AnFFITypeWithAlongName+ { a :: X,+ b :: Y+ }
@@ -0,0 +1,6 @@+data+ {-# CTYPE "header.h" "an-ffi-type-with-along-name" #-}+ AnFFITypeWithAlongName = AnFFITypeWithAlongName+ { a :: X,+ b :: Y+ }
@@ -1,1 +0,0 @@-data {-# CTYPE "unistd.h" "useconds_t" #-} T
@@ -1,1 +0,0 @@-data {-# CTYPE "unistd.h" "useconds_t" #-} T
@@ -0,0 +1,11 @@+data (IsString s) => T s = T++data+ (IsString s) =>+ T s = T++data+ ( IsString s,+ IsString s+ ) =>+ T s = T
@@ -0,0 +1,8 @@+data IsString s => T s = T++data IsString s =>+ T s = T++data+ ( IsString s+ , IsString s ) => T s = T
@@ -2,7 +2,7 @@ data Foo = forall a. MkFoo a (a -> Bool)- | forall a. Eq a => MkBar a+ | forall a. (Eq a) => MkBar a data Bar = forall x y.
@@ -2,4 +2,4 @@ data Foo = forall a. MkFoo a (a -> Bool) -data Bar = forall a b. a + b => Bar a b+data Bar = forall a b. (a + b) => Bar a b
@@ -0,0 +1,9 @@+{-# LANGUAGE UnicodeSyntax #-}++data Foo+ = forall a.+ Foo++data Bar+ = forall a.+ Bar
@@ -0,0 +1,7 @@+{-# LANGUAGE UnicodeSyntax #-}++data Foo = forall+ a. Foo++data Bar = ∀+ a. Bar
@@ -0,0 +1,10 @@+-- | Foo.+data Foo = Foo+ { -- | Something+ foo :: Foo Int Int,+ -- | Something else+ bar ::+ Bar+ Char+ Char+ }
@@ -0,0 +1,9 @@+-- | Foo.++data Foo = Foo+ { foo :: Foo Int Int+ -- ^ Something+ , bar :: Bar Char+ Char+ -- ^ Something else+ }
@@ -0,0 +1,11 @@+-- | Foo.+data Foo+ = Foo+ { -- | Something+ foo :: Foo Int Int,+ -- | Something else+ bar ::+ Bar+ Char+ Char+ }
@@ -0,0 +1,10 @@+-- | Foo.++data Foo =+ Foo+ { foo :: Foo Int Int+ -- ^ Something+ , bar :: Bar Char+ Char+ -- ^ Something else+ }
@@ -0,0 +1,7 @@+data IndexWithInfo schema+ = forall x.+ IndexWithInfo+ { checkedIndex :: Index schema x,+ checkedIndexName :: U.Variable,+ checkedIndexType :: Type x+ }
@@ -0,0 +1,7 @@+data IndexWithInfo schema =+ forall x.+ IndexWithInfo+ { checkedIndex :: Index schema x+ , checkedIndexName :: U.Variable+ , checkedIndexType :: Type x+ }
@@ -1,12 +0,0 @@-module Main where---- | Foo.-data Foo = Foo- { -- | Something- foo :: Foo Int Int,- -- | Something else- bar ::- Bar- Char- Char- }
@@ -1,11 +0,0 @@-module Main where---- | Foo.--data Foo = Foo- { foo :: Foo Int Int- -- ^ Something- , bar :: Bar Char- Char- -- ^ Something else- }
@@ -9,17 +9,11 @@ forall a b. (Show a, Eq b) => -- foo -- bar- a ->- b ->- Foo 'Int+ a -> b -> Foo 'Int -- | But 'Bar' is also not too bad. Bar ::- Int ->- Maybe Text ->- Foo 'Bool+ Int -> Maybe Text -> Foo 'Bool -- | So is 'Baz'. Baz ::- forall a.- a ->- Foo 'String+ forall a. a -> Foo 'String (:~>) :: Foo a -> Foo a -> Foo a
@@ -5,3 +5,26 @@ c where Foo :: a -> b -> c -> Foo a b c++data+ Foo ::+ Type ->+ Type ->+ Type+ where+ Foo :: Foo a b++data+ Foo a b c ::+ Type -> Type -> Type -> Type+ where+ Foo :: Foo a b c++data+ Vec ::+ Type ->+ Type ->+ Type+ where+ Nil :: Vec a Ze+ Cons :: a -> Vec a n -> Vec a (Su n)
@@ -4,3 +4,20 @@ b c where Foo :: a -> b -> c -> Foo a b c++data Foo :: Type+ -> Type+ -> Type where+ Foo :: Foo a b++data Foo a b c ::+ Type -> Type -> Type -> Type where+ Foo :: Foo a b c++data Vec+ :: Type+ -> Type+ -> Type+ where+ Nil :: Vec a Ze+ Cons :: a -> Vec a n -> Vec a (Su n)
@@ -4,12 +4,10 @@ data GADT1 a where GADT11, GADT12 ::- Int ->- GADT1 a+ Int -> GADT1 a data GADT2 a where GADT21, GADT21, GADT22 ::- Int ->- GADT2 a+ Int -> GADT2 a
@@ -0,0 +1,4 @@+{-# LANGUAGE UnicodeSyntax #-}++data Foo :: Type -> Type where+ Foo :: a -> Foo a
@@ -0,0 +1,4 @@+{-# LANGUAGE UnicodeSyntax #-}++data Foo ∷ Type → Type where+ Foo ∷ a → Foo a
@@ -0,0 +1,51 @@+{- https://github.com/tweag/ormolu/issues/758 -}++data A+ = -- | Docs for :#+ A :# A++data WithDocs+ = forall left right.+ (Show left) =>+ -- | Docs for left arg+ left+ -- | Docs for op+ :*:+ -- | Docs for right arg+ right++data MixedDocs+ = forall left right.+ (Show left) =>+ left -- ^ before+ :*:+ -- | after+ right++data DocPartial+ = Left -- ^ left docs+ -- on multiple+ -- lines+ :*:+ Right+ | -- | op+ Left+ :*:+ Right+ | Left+ :*:+ -- | right+ Right+ | -- | op+ Left+ :*:+ Right+ | -- | op+ Left+ :*:+ Right++data NoDocs+ = Left+ :*:+ Right
@@ -0,0 +1,43 @@+{- https://github.com/tweag/ormolu/issues/758 -}++data A = A :# A -- ^ Docs for :#++data WithDocs+ = forall left right.+ Show left =>+ left -- ^ Docs for left arg+ :*: -- ^ Docs for op+ right -- ^ Docs for right arg++data MixedDocs+ -- | before+ = forall left right.+ Show left =>+ left :*: right+ -- ^ after++data DocPartial+ = Left -- ^ left docs+ -- on multiple+ -- lines+ :*: Right+ | Left+ :*: -- ^ op+ Right+ | Left+ :*:+ -- | right+ Right+ | -- | op+ Left+ :*:+ Right+ | Left+ :*:+ Right+ -- ^ op++data NoDocs+ = Left+ :*:+ Right
@@ -0,0 +1,2 @@+type T :: forall k. k -> forall j. j -> Type+data T @k (a :: k) @(j :: Type) (b :: j)
@@ -0,0 +1,2 @@+type T :: forall k. k -> forall j. j -> Type+data T @k (a :: k) @(j :: Type) (b :: j)
@@ -0,0 +1,11 @@+{-# LANGUAGE LinearTypes #-}++data Record = Rec {x %'Many :: Int, y :: Char}++data T2 a b c where+ MkT2 :: a -> b %1 -> c %1 -> T2 a b c++data T2 a b c = MkT2 {x %Many :: a, y :: b, z :: c}++data T3 a m where+ MkT3 :: a %m -> T3 a m
@@ -0,0 +1,10 @@+{-# LANGUAGE LinearTypes #-}+data Record = Rec { x %'Many :: Int, y :: Char }++data T2 a b c where+ MkT2 :: a -> b %1 -> c %1 -> T2 a b c++data T2 a b c = MkT2 { x %Many :: a, y :: b, z :: c }++data T3 a m where+ MkT3 :: a %m -> T3 a m
@@ -0,0 +1,6 @@+{-# LANGUAGE ExistentialQuantification #-}++data Foo = forall a b. (Show a, Eq b) => Bar+ { foo :: a,+ bars :: b+ }
@@ -0,0 +1,5 @@+{-# LANGUAGE ExistentialQuantification #-}+data Foo = forall a b . (Show a, Eq b) => Bar+ { foo :: a+ , bars :: b+ }
@@ -12,7 +12,7 @@ fooGag, fooGog :: NonEmpty- ( Indentity+ ( Identity Bool ), -- | Huh!
@@ -6,7 +6,7 @@ { fooX :: Int -- ^ X , fooY :: Int -- ^ Y , fooBar, fooBaz :: NonEmpty (Identity Bool) -- ^ BarBaz- , fooGag, fooGog :: NonEmpty (Indentity+ , fooGag, fooGog :: NonEmpty (Identity Bool) -- ^ GagGog , fooFoo
@@ -0,0 +1,27 @@+data T a where+ Typed :: forall a -> a -> T a++f1 (Typed a x) = x :: a++f2 (Typed Int n) = n * 2++f3 (Typed ((->) w Bool) g) = not . g++data D x where+ MkD1 ::+ forall a b ->+ a ->+ b ->+ D (a, b)+ MkD2 ::+ forall a.+ forall b ->+ a ->+ b ->+ D (a, b)+ MkD3 ::+ forall a ->+ a ->+ forall b ->+ b ->+ D (a, b)
@@ -0,0 +1,24 @@+data T a where+ Typed :: forall a -> a -> T a++f1 (Typed a x) = x :: a+f2 (Typed Int n) = n*2+f3 (Typed ((->) w Bool) g) = not . g++data D x where+ MkD1 :: forall a b ->+ a ->+ b ->+ D (a, b)++ MkD2 :: forall a.+ forall b ->+ a ->+ b ->+ D (a, b)++ MkD3 :: forall a ->+ a ->+ forall b ->+ b ->+ D (a, b)
@@ -1,7 +1,8 @@ module Main where -- | Here we go.-data Foo = Foo {unFoo :: Int}+data Foo+ = Foo {unFoo :: Int} deriving (Eq) -- | And once again.
@@ -0,0 +1,7 @@+data FutureSumType+ = -- | This is what the documentation for this type looks like.+ -- It is pretty awkward that the @--@s aren't aligned.+ SingleConstructor+ { someRecordField :: Bool,+ someOtherRecordField :: Int+ }
@@ -0,0 +1,6 @@+data FutureSumType = -- | This is what the documentation for this type looks like.+ -- It is pretty awkward that the @--@s aren't aligned.+ SingleConstructor+ { someRecordField :: Bool,+ someOtherRecordField :: Int+ }
@@ -0,0 +1,8 @@+type data Universe = Character | Number | Boolean++type data Maybe a+ = Just a+ | Nothing++type data P :: Type -> Type -> Type where+ MkP :: (a ~ Natural, b ~~ Char) => P a b
@@ -0,0 +1,7 @@+type data Universe = Character | Number | Boolean++type data Maybe a = Just a+ | Nothing++type data P :: Type -> Type -> Type where+ MkP :: (a ~ Natural, b ~~ Char) => P a b
@@ -1,7 +1,7 @@ data Foo = -- | Bar Bar+ -- | Field 1 Field1- -- ^ Field 1+ -- | Field 2 Field2- -- ^ Field 2
@@ -1,5 +1,5 @@ data X = B+ -- | y !Int- -- ^ y C
@@ -0,0 +1,11 @@+-- | Describes what sort of dictionary to generate for type class instances+data Evidence+ = -- | An existing named instance+ NamedInstance (Qualified Ident)+ | -- | Computed instances+ WarnInstance+ -- | Warn type class with a user-defined warning message+ SourceType+ | -- | The IsSymbol type class for a given Symbol literal+ IsSymbolInstance PSString+ deriving (Show, Eq)
@@ -0,0 +1,9 @@+-- | Describes what sort of dictionary to generate for type class instances+data Evidence+ -- | An existing named instance+ = NamedInstance (Qualified Ident)++ -- | Computed instances+ | WarnInstance SourceType -- ^ Warn type class with a user-defined warning message+ | IsSymbolInstance PSString -- ^ The IsSymbol type class for a given Symbol literal+ deriving (Show, Eq)
@@ -0,0 +1,5 @@+data A+ = A+ -- | a number+ Int+ Bool
@@ -0,0 +1,1 @@+data A = A {- | a number -} Int Bool
@@ -0,0 +1,1 @@+data Proxy _ = Proxy
@@ -0,0 +1,1 @@+data Proxy _ = Proxy
@@ -1,3 +1,5 @@+module MyModule (default Monoid) where+ default (Int, Foo, Bar) default@@ -5,3 +7,9 @@ Foo, Bar )++default Num (Int, Float)++default IsList ([], Vector)++default IsString (Text.Text, Foundation.String, String)
@@ -1,6 +1,13 @@+module MyModule (default Monoid) where+ default ( Int , Foo , Bar ) default ( Int , Foo, Bar )++default Num (Int, Float)+default IsList ([], Vector)++default IsString (Text.Text, Foundation.String, String)
@@ -0,0 +1,8 @@+{-# LANGUAGE MultilineStrings #-}++foreign import capi+ """+ foo+ bar+ """+ foo :: Int -> Int
@@ -0,0 +1,6 @@+{-# language MultilineStrings #-}++foreign import capi """+ foo+ bar+ """ foo :: Int -> Int
@@ -1,4 +1,4 @@-instance Eq a => Eq [a] where (==) _ _ = False+instance (Eq a) => Eq [a] where (==) _ _ = False instance ( Ord a,
@@ -1,4 +1,4 @@-instance Num a => Num (Diff a) where+instance (Num a) => Num (Diff a) where D u dudx + D v dvdx = D (u + v) (dudx + dvdx) D u dudx - D v dvdx = D (u - v) (dudx - dvdx) D u dudx * D v dvdx = D (u * v) (u * dvdx + v * dudx)
@@ -0,0 +1,1 @@+{-# RULES "map-loop" [~] forall f. map' f = map' (id . f) #-}
@@ -0,0 +1,1 @@+{-# RULES "map-loop" [ ~ ] forall f . map' f = map' (id . f) #-}
@@ -11,7 +11,7 @@ -- when we disable the rule that expands (++) into foldr -- The foldr/cons rule looks nice, but it can give disastrously--- bloated code when commpiling+-- bloated code when compiling -- array (a,b) [(1,2), (2,2), (3,2), ...very long list... ] -- i.e. when there are very very long literal lists -- So I've disabled it for now. We could have special cases
@@ -11,7 +11,7 @@ -- when we disable the rule that expands (++) into foldr -- The foldr/cons rule looks nice, but it can give disastrously--- bloated code when commpiling+-- bloated code when compiling -- array (a,b) [(1,2), (2,2), (3,2), ...very long list... ] -- i.e. when there are very very long literal lists -- So I've disabled it for now. We could have special cases
@@ -8,9 +8,7 @@ z ( g :: forall b.- (a -> b -> b) ->- b ->- b+ (a -> b -> b) -> b -> b ). foldr k z (build g) = g k z
@@ -1,3 +1,9 @@ infix 0 <?> infix 9 <^-^>++infix 2 ->++infix 0 type <!>++infix 9 +
@@ -1,2 +1,8 @@ infix 0 <?> infix 9 <^-^>++infix 2 ->++infix 0 type <!>++infix +
@@ -1,3 +1,5 @@ infixl 8 *** infixl 0 $, *, +, &&, **++infixl 9 type $
@@ -1,2 +1,4 @@ infixl 8 *** infixl 0 $, *, +, &&, **++infixl 9 type $
@@ -1,3 +1,5 @@ infixr 8 `Foo` infixr 0 ***, &&&++infixr 0 data $
@@ -1,2 +1,4 @@ infixr 8 `Foo` infixr 0 ***, &&&++infixr 0 data $
@@ -9,3 +9,7 @@ baz :: Int -> Int baz = id {-# NOINLINE [~2] baz #-}++blub :: Int -> Int+blub = baz+{-# OPAQUE blub #-}
@@ -11,3 +11,7 @@ baz = id {-# NOINLINE [~2] baz #-}++blub :: Int -> Int+blub = baz+{-# opaque blub #-}
@@ -0,0 +1,8 @@+{-# SPECIALIZE addMult @Double #-}+{-# SPECIALIZE addMult (5 :: Int) #-}+{-# SPECIALIZE addMult 5 :: Int -> Int #-}++{-# SPECIALIZE [1] forall x y. f @Int True (x, y) #-}++{-# SPECIALIZE forall x xs. loop (x : xs)+ #-}
@@ -0,0 +1,9 @@+{-# SPECIALISE addMult @Double #-}+{-# SPECIALISE addMult (5 :: Int) #-}+{-# SPECIALISE addMult 5 :: Int -> Int #-}++{-# SPECIALISE [1] forall x y. f @Int True (x,y) #-}++{-# SPECIALISE+ forall x xs .+ loop (x:xs) #-}
@@ -0,0 +1,10 @@+sep, fsep, hsep :: (Applicative m, Foldable t) => t (m Doc) -> m Doc+sep = fmap P.sep . sequenceAFoldable+{-# SPECIALIZE NOINLINE sep :: [TCM Doc] -> TCM Doc #-}+{-# SPECIALIZE NOINLINE sep :: List1 (TCM Doc) -> TCM Doc #-}+fsep = fmap P.fsep . sequenceAFoldable+{-# SPECIALIZE NOINLINE [2] fsep :: [TCM Doc] -> TCM Doc #-}+{-# SPECIALIZE NOINLINE [2] fsep :: List1 (TCM Doc) -> TCM Doc #-}+hsep = fmap P.hsep . sequenceAFoldable+{-# SPECIALIZE NOINLINE [~2] hsep :: [TCM Doc] -> TCM Doc #-}+{-# SPECIALIZE NOINLINE [~2] hsep :: List1 (TCM Doc) -> TCM Doc #-}
@@ -0,0 +1,4 @@+sep, fsep, hsep :: (Applicative m, Foldable t) => t (m Doc) -> m Doc+sep = fmap P.sep . sequenceAFoldable ; {-# SPECIALIZE NOINLINE sep :: [TCM Doc] -> TCM Doc #-} ; {-# SPECIALIZE NOINLINE sep :: List1 (TCM Doc) -> TCM Doc #-}+fsep = fmap P.fsep . sequenceAFoldable ; {-# SPECIALIZE NOINLINE [2] fsep :: [TCM Doc] -> TCM Doc #-} ; {-# SPECIALIZE NOINLINE [2] fsep :: List1 (TCM Doc) -> TCM Doc #-}+hsep = fmap P.hsep . sequenceAFoldable ; {-# SPECIALIZE NOINLINE [~2] hsep :: [TCM Doc] -> TCM Doc #-} ; {-# SPECIALIZE NOINLINE [~2] hsep :: List1 (TCM Doc) -> TCM Doc #-}
@@ -8,7 +8,6 @@ instance (Num r, V.Vector v r, Factored m r) => Num (VT v m r) where {-# SPECIALIZE instance- ( Factored m Int => Num (VT U.Vector m Int)- )+ ((Factored m Int) => Num (VT U.Vector m Int)) #-} VT x + VT y = VT $ V.zipWith (+) x y
@@ -1,13 +1,13 @@-foo :: Num a => a -> a+foo :: (Num a) => a -> a foo = id {-# SPECIALIZE foo :: Int -> Int #-} {-# SPECIALIZE INLINE foo :: Float -> Float #-} {-# SPECIALIZE NOINLINE [2] bar :: Int -> Int #-}-bar :: Num a => a -> a+bar :: (Num a) => a -> a bar = id -baz :: Num a => a -> a+baz :: (Num a) => a -> a baz = id {-# SPECIALIZE [~2] baz :: Int ->@@ -20,5 +20,5 @@ Bool, Integer -> Bool #-}-fits13Bits :: Integral a => a -> Bool+fits13Bits :: (Integral a) => a -> Bool fits13Bits x = x >= -4096 && x < 4096
@@ -1,4 +1,4 @@ {-# LANGUAGE UnicodeSyntax #-} -foo :: forall a. Show a => a -> String+foo :: forall a. (Show a) => a -> String foo = const ()
@@ -0,0 +1,6 @@+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE UnicodeSyntax #-}++ascii = [|x|]++unicode = [|x|]
@@ -0,0 +1,6 @@+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE UnicodeSyntax #-}++ascii = [|x|]++unicode = ⟦x⟧
@@ -10,3 +10,7 @@ [d| foo bar |]++header =+ [here|+#include foo|]
@@ -9,3 +9,6 @@ [d| foo bar |]++header = [here|+#include foo|]
@@ -1,7 +1,6 @@ {-# LANGUAGE TemplateHaskell #-} x =- $$( foo bar- )+ $$(foo bar) x = $$foo
@@ -23,3 +23,8 @@ F Bool = Char F a = String++type family F a where+ F a -- foo+ =+ a
@@ -12,3 +12,7 @@ F Bool = Char F a = String++type family F a where+ F a -- foo+ = a
@@ -0,0 +1,2 @@+type family Foo a where+ Foo '( 'x', a) = a
@@ -0,0 +1,2 @@+type family Foo a where+ Foo '( 'x', a) = a
@@ -0,0 +1,10 @@+type family LT a b where+ -- 0+ LT 0 _ = True+ -- 1+ LT 1 0 = False+ LT 1 _ = True+ -- 2+ LT 2 0 = False+ LT 2 1 = False+ LT 2 _ = True
@@ -0,0 +1,12 @@+type family LT a b where+ -- 0+ LT 0 _ = True++ -- 1+ LT 1 0 = False+ LT 1 _ = True++ -- 2+ LT 2 0 = False+ LT 2 1 = False+ LT 2 _ = True
@@ -1,3 +1,5 @@+import Servant.API+ type Foo a b c = Bar c a b @@ -16,3 +18,7 @@ "route1" :> ApiRoute1 :<|> "route2" :> ApiRoute2 -- comment here :<|> OmitDocs :> "i" :> ASomething API++type A -- foo+ =+ B
@@ -1,3 +1,5 @@+import Servant.API+ type Foo a b c = Bar c a b @@ -15,3 +17,6 @@ = "route1" :> ApiRoute1 :<|> "route2" :> ApiRoute2 -- comment here :<|> OmitDocs :> "i" :> ASomething API++type A -- foo+ = B
@@ -0,0 +1,4 @@+type Test =+ ( -- a+ x+ )
@@ -0,0 +1,3 @@+type Test = (+ -- a+ x)
@@ -13,3 +13,7 @@ type E = TypeError ('Text "Some text") type G = '[ '( 'Just, 'Bool)]++type X = () '`PromotedInfix` ()++type A = '[ 'a']
@@ -7,3 +7,7 @@ type E = TypeError ('Text "Some text") type G = '[ '( 'Just, 'Bool) ]++type X = () '`PromotedInfix` ()++type A = '[ 'a' ]
@@ -0,0 +1,5 @@+{-# LANGUAGE NoListTuplePuns #-}++type X = (Int, String)++type Y = [String, Int]
@@ -0,0 +1,5 @@+{-# Language NoListTuplePuns #-}++type X = (Int, String)++type Y = [String, Int]
@@ -0,0 +1,1 @@+type Const a _ = a
@@ -0,0 +1,1 @@+type Const a _ = a
@@ -1,19 +1,19 @@ main = do- x- y- z+ x+ y+ z main = case foo of- x -> a- foo- a- b+ x -> a+ foo+ a+ b main = do- if x then y else z- foo- a- b+ if x then y else z+ foo+ a+ b
@@ -1,13 +1,11 @@ {-# LANGUAGE TemplateHaskell #-} foo = do- $( bar- )+ $(bar) baz foo = do- $$( bar- )+ $$(bar) baz foo = do@@ -16,8 +14,8 @@ foo = do do- (+ 1)- 2+ (+ 1)+ 2 foo = do case () of () -> (+ 1)@@ -25,8 +23,8 @@ foo = do case () of- () -> (+ 1)- 2+ () -> (+ 1)+ 2 foo = do \case 2 -> 3@@ -34,5 +32,5 @@ foo = do \case- 2 -> 3- 2+ 2 -> 3+ 2
@@ -8,4 +8,5 @@ LT -> \a -> returnA -< x + a EQ -> \b -> returnA -< y + z + b GT -> \c -> returnA -< z + x- ) 1+ )+ 1
@@ -12,7 +12,7 @@ ) -> do -- Begin do- (x, y) <- -- GHC parser fails if layed out over multiple lines+ (x, y) <- -- GHC parser fails if laid out over multiple lines f -- Call into f ( a, c -- Tuple together arguments@@ -29,7 +29,8 @@ Left ( z, w- ) -> \u -> -- Procs can have lambdas+ ) -> \u ->+ -- Procs can have lambdas let v = u -- Actually never used ^ 2@@ -58,5 +59,8 @@ -< ( i + x- * y -- Just do the calculation+ * y -- Just do the calculation )++traverseA_ f = proc (e, (xs, s)) ->+ (| foldlA' (\() x -> do (e, (x, s)) >- f; () >- returnA) |) () xs
@@ -9,7 +9,7 @@ (e, f) ) -> do -- Begin do- (x,y) -- GHC parser fails if layed out over multiple lines+ (x,y) -- GHC parser fails if laid out over multiple lines <- f -- Call into f (a, c) -- Tuple together arguments@@ -47,3 +47,6 @@ returnA -< (i + x * y) -- Just do the calculation++traverseA_ f = proc (e, (xs, s)) ->+ (| foldlA' (\() x -> do { (e, (x, s)) >- f; () >- returnA }) |) () xs
@@ -1,7 +1,6 @@ {-# LANGUAGE Arrows #-} -bar f = proc a -> do- b <- f -< a+bar f = proc a -> do b <- f -< a barbar f g = proc a -> do b <- f -< a@@ -16,3 +15,15 @@ f -< a++foo =+ proc x ->+ do+ returnA -< x+ 1++foo a =+ proc x ->+ case Left x of+ Left x -> returnA -< x+ a
@@ -18,3 +18,13 @@ -< a +foo =+ proc x -> do+ returnA -< x+ 1++foo a =+ proc x ->+ case Left x of+ Left x -> returnA -< x+ a
@@ -1,7 +1,6 @@ {-# LANGUAGE Arrows #-} -foo f = proc a -> do- f -< a+foo f = proc a -> do f -< a bazbaz f g h = proc (a, b, c) -> do x <-@@ -20,3 +19,5 @@ returnA -< (x, y, z)++bar f = proc x -> do { f -< x } <+> do f -< x
@@ -18,3 +18,5 @@ ) returnA -< (x, y, z)++bar f = proc x -> do {f -< x} <+> do f -< x
@@ -10,4 +10,12 @@ (| bar (bindA -< y)- |) z+ |)+ z++foo2 = proc () -> do+ ( proc () ->+ returnA -< ()+ )+ -<+ ()
@@ -11,3 +11,8 @@ bar (bindA -< y) |) z++foo2 = proc () -> do+ (proc () ->+ returnA -< ()+ ) -< ()
@@ -15,27 +15,32 @@ ( (h f . h g) -< (y x) . y z- ) |||- ( (h g . h f)- -<- y z . (y x)- )+ )+ ||| ( (h g . h f)+ -<+ y z . (y x)+ ) bar4 = proc x -> case x of Just f -> f -< () Nothing -> x -< ()- <+> do- g -< x+ <+> do+ g -< x expr' = proc x -> do returnA -< x- <+> do- symbol Plus -< ()- y <- term -< ()- expr' -< x + y- <+> do- symbol Minus -< ()- y <- term -< ()- expr' -< x - y+ <+> do+ symbol Plus -< ()+ y <- term -< ()+ expr' -< x + y+ <+> do+ symbol Minus -< ()+ y <- term -< ()+ expr' -< x - y++bar f = proc (a, b) -> do+ (f a -< b)+ >-> (\y -> f b >- a)+ >-> (\y -> f b >- a)
@@ -34,3 +34,8 @@ symbol Minus -< () y <- term -< () expr' -< x - y++bar f = proc (a, b) -> do+ (f a -< b)+ >-> (\y -> f b >- a)+ >-> (\y -> f b >- a)
@@ -5,5 +5,6 @@ bar = proc x -> \f g h -> \() ->- \(Left (x, y)) -> -- Tuple value+ \(Left (x, y)) ->+ -- Tuple value f (g (h x)) -< y
@@ -4,8 +4,7 @@ bar f g = proc a -> ( ( (f)- ( g- )+ (g) ) -< ( ( ( ( ( ( g
@@ -32,3 +32,5 @@ do a do b do c++f11 = do a do b do c do d
@@ -28,3 +28,5 @@ do { a } do { b } do c++f11 = do a do b do c do d
@@ -0,0 +1,6 @@+absurd x = case x of {}+absurd = \case {}+absurd x = case x of {}+absurd = \case {}++foo = case () of {} 1
@@ -0,0 +1,6 @@+absurd x = case x of+absurd = \case+absurd x = case x of {}+absurd = \case {}++foo = case () of {} 1
@@ -3,8 +3,8 @@ case x of x | x > 10 ->- foo- + bar+ foo+ + bar x | x > 5 -> 10 _ -> 20
@@ -0,0 +1,2 @@+getValue :: Maybe Int -> Int+getValue x = case x of Just n -> n; Nothing -> 0
@@ -0,0 +1,2 @@+getValue :: Maybe Int -> Int+getValue x = case x of {Just n -> n; Nothing -> 0}
@@ -5,14 +5,14 @@ [ ( x, y )- | x <- xs,- y <- ys,- then group by- -- First comment- ( x- + y- )- using- -- Second comment- groupWith -- Third comment+ | x <- xs,+ y <- ys,+ then group by+ -- First comment+ ( x+ + y+ )+ using+ -- Second comment+ groupWith -- Third comment ]
@@ -4,9 +4,9 @@ [ ( x, y )- | x <- xs,- y <- ys,- then- -- First comment- reverse -- Second comment+ | x <- xs,+ y <- ys,+ then+ -- First comment+ reverse -- Second comment ]
@@ -4,13 +4,13 @@ [ ( x, y )- | x <- xs,- y <- ys,- then- -- First comment- sortWith- by- ( x- + y -- Second comment- )+ | x <- xs,+ y <- ys,+ then+ -- First comment+ sortWith+ by+ ( x+ + y -- Second comment+ ) ]
@@ -4,9 +4,9 @@ [ ( x, y )- | x <- xs,- y <- ys,- then group using- -- First comment- permutations -- Second comment+ | x <- xs,+ y <- ys,+ then group using+ -- First comment+ permutations -- Second comment ]
@@ -4,14 +4,14 @@ [ ( x, y )- | x <- xs,- y <- ys,- then group by- -- First comment- ( x- + y- )- using- -- Second comment- groupWith -- Third comment+ | x <- xs,+ y <- ys,+ then group by+ -- First comment+ ( x+ + y+ )+ using+ -- Second comment+ groupWith -- Third comment ]
@@ -0,0 +1,13 @@+handleInput :: IO ()+handleInput = do+ putStrLn "Enter command:"+ cmd <- getLine+ case cmd of+ "quit" -> putStrLn "Goodbye"+ "help" -> do+ putStrLn "Available commands:"+ putStrLn " quit - exit the program"+ putStrLn " help - show this message"+ _ -> do+ putStrLn $ "Unknown command: " ++ cmd+ handleInput
@@ -0,0 +1,13 @@+handleInput :: IO ()+handleInput = do+ putStrLn "Enter command:"+ cmd <- getLine+ case cmd of+ "quit" -> putStrLn "Goodbye"+ "help" -> do+ putStrLn "Available commands:"+ putStrLn " quit - exit the program"+ putStrLn " help - show this message"+ _ -> do+ putStrLn $ "Unknown command: " ++ cmd+ handleInput
@@ -0,0 +1,2 @@+checkValue :: Int -> IO ()+checkValue n = do putStr "Value is: "; case () of { _ | n < 0 -> putStrLn "negative" | n == 0 -> putStrLn "zero" | otherwise -> putStrLn "positive" }
@@ -0,0 +1,2 @@+checkValue :: Int -> IO ()+checkValue n = do {putStr "Value is: "; case () of {_ | n < 0 -> putStrLn "negative" | n == 0 -> putStrLn "zero" | otherwise -> putStrLn "positive"}}
@@ -0,0 +1,2 @@+processValue :: Maybe Int -> IO ()+processValue x = do putStrLn "Processing:"; \case { Just n -> print n; Nothing -> putStrLn "Empty" } x; putStrLn "Done"
@@ -0,0 +1,2 @@+processValue :: Maybe Int -> IO ()+processValue x = do {putStrLn "Processing:"; \case {Just n -> print n; Nothing -> putStrLn "Empty"} x; putStrLn "Done"}
@@ -0,0 +1,2 @@+processPair :: Maybe Int -> Maybe String -> IO ()+processPair x y = do case x of { Just n -> print n; Nothing -> putStrLn "No number" }; case y of { Just s -> putStrLn s; Nothing -> putStrLn "No string" }
@@ -0,0 +1,2 @@+processPair :: Maybe Int -> Maybe String -> IO ()+processPair x y = do {case x of {Just n -> print n; Nothing -> putStrLn "No number"}; case y of {Just s -> putStrLn s; Nothing -> putStrLn "No string"}}
@@ -0,0 +1,2 @@+nestedDo :: Either String Int -> IO ()+nestedDo e = do putStr "Start: "; case e of { Left s -> do { putStr "Error: "; putStrLn s }; Right n -> do { putStr "Value: "; print n } }; putStrLn "End"
@@ -0,0 +1,2 @@+nestedDo :: Either String Int -> IO ()+nestedDo e = do {putStr "Start: "; case e of {Left s -> do {putStr "Error: "; putStrLn s}; Right n -> do {putStr "Value: "; print n}}; putStrLn "End"}
@@ -0,0 +1,2 @@+doGuessing :: (Ord t, Read t) => t -> IO ()+doGuessing num = do putStrLn "Enter your guess:"; guess <- getLine; case compare (read guess) num of { LT -> do { putStrLn "Too low!"; doGuessing num }; GT -> do { putStrLn "Too high!"; doGuessing num }; EQ -> putStrLn "You win!" }
@@ -0,0 +1,2 @@+doGuessing :: (Ord t, Read t) => t -> IO ()+doGuessing num = do {putStrLn "Enter your guess:"; guess <- getLine; case compare (read guess) num of {LT -> do {putStrLn "Too low!"; doGuessing num}; GT -> do { putStrLn "Too high!"; doGuessing num}; EQ -> putStrLn "You win!"}}
@@ -0,0 +1,23 @@+module A (a) where++a :: Int+a = do+ f+ . do+ g+ $ do+ 1+ + 2+ * 3+ $ ( 6+ * 5+ + 4+ )++b =+ f a <> 1 + 2 <> do+ 3++c =+ f b $ 1 + 2 $ do+ 3
@@ -0,0 +1,23 @@+module A (a) where++a :: Int+a = do+ f+ . do+ g+ $ do+ 1+ + 2+ * 3+ $ ( 6 *+ 5 ++ 4+ )++b =+ f a <> 1 + 2 <> do+ 3++c =+ f b $ 1 + 2 $ do+ 3
@@ -2,9 +2,8 @@ forall outertag innertag t outer inner m a. ( forall x. Coercible (t m x) (m x), forall m'.- HasCatch outertag outer m' =>+ (HasCatch outertag outer m') => HasCatch innertag inner (t m'), HasCatch outertag outer m ) =>- (forall m'. HasCatch innertag inner m' => m' a) ->- m a+ (forall m'. (HasCatch innertag inner m') => m' a) -> m a
@@ -2,9 +2,8 @@ forall outertag innertag t outer inner m a. ( forall x. Coercible (t m x) (m x), forall m'.- HasReader outertag outer m' =>+ (HasReader outertag outer m') => HasReader innertag inner (t m'), HasReader outertag outer m ) =>- (forall m'. HasReader innertag inner m' => m' a) ->- m a+ (forall m'. (HasReader innertag inner m') => m' a) -> m a
@@ -10,3 +10,5 @@ quux :: Int -> Int quux x | x < 0 = x quux x = x++(a, b) | c = d
@@ -10,3 +10,5 @@ quux :: Int -> Int quux x | x < 0 = x quux x = x++(a, b) | c = d
@@ -0,0 +1,5 @@+foo x = do+ y <- quux+ if x > 2+ then bar x+ else baz y
@@ -0,0 +1,5 @@+foo x = do+ y <- quux+ if x > 2+ then bar x+ else baz y
@@ -0,0 +1,4 @@+foo x =+ if x > 2+ then bar x+ else baz x
@@ -0,0 +1,4 @@+foo x =+ if x > 2+ then bar x+ else baz x
@@ -0,0 +1,7 @@+foo =+ if undefined+ -- then comment+ then undefined+ -- else comment+ else do+ undefined
@@ -0,0 +1,8 @@+foo =+ if undefined+ -- then comment+ then undefined+ -- else comment+ else+ do+ undefined
@@ -0,0 +1,10 @@+foo =+ if something+ -- then comment+ then do+ stuff+ stuff+ -- else comment+ else do+ stuff+ stuff
@@ -0,0 +1,10 @@+foo =+ if something+ -- then comment+ then do+ stuff+ stuff+ -- else comment+ else do+ stuff+ stuff
@@ -0,0 +1,14 @@+foo =+ if x+ then+ -- comment 1+ -- comment 2+ case a of+ Just b -> _+ Nothing -> _+ else+ -- comment 3+ -- comment 4+ case a of+ Just b -> _+ Nothing -> _
@@ -0,0 +1,12 @@+foo =+ if x+ then+ -- comment 1+ -- comment 2+ foo 1 2 3+ else+ -- comment 3+ -- comment 4+ foo+ "here"+ "there"
@@ -0,0 +1,12 @@+foo =+ if x+ then+ -- comment 1+ -- comment 2+ foo 1 2 3+ else+ -- comment 3+ -- comment 4+ foo+ "here"+ "there"
@@ -0,0 +1,14 @@+foo =+ if x+ then+ -- comment 1+ -- comment 2+ case a of+ Just b -> _+ Nothing -> _+ else+ -- comment 3+ -- comment 4+ case a of+ Just b -> _+ Nothing -> _
@@ -0,0 +1,10 @@+foo =+ if x+ then -- comment 1+ -- comment 2+ foo 1 2 3+ else -- comment 3+ -- comment 4+ foo+ "here"+ "there"
@@ -0,0 +1,10 @@+foo =+ if x+ then -- comment 1+ -- comment 2+ foo 1 2 3+ else -- comment 3+ -- comment 4+ foo+ "here"+ "there"
@@ -1,8 +0,0 @@-foo =- if undefined- then -- then comment- undefined- else -- else comment-- do- undefined
@@ -1,8 +0,0 @@-foo =- if undefined- -- then comment- then undefined- -- else comment- else- do- undefined
@@ -11,6 +11,5 @@ a -> a -> Bool, ?foo :: Int ) =>- [a] ->- [a]+ [a] -> [a] sort' = sort
@@ -1,4 +1,5 @@ f =- Foo <$> bar+ Foo+ <$> bar <*> baz <*> baz'
@@ -0,0 +1,22 @@+module Main where++foo =+ fmap escapeLeadingDollar+ . dropPaddingSpace+ . dropWhileEnd T.null+ . fmap (T.stripEnd . T.pack)+ . lines+ $ unpackHDS docStr++foo =+ when (GHC.xopt Cpp dynFlags && not cfgTolerateCpp) $+ throwIO (OrmoluCppEnabled path)++foo =+ bar $+ baz $+ quux++x =+ case l of { A -> B } $+ case q of r -> s
@@ -0,0 +1,22 @@+module Main where++foo =+ fmap escapeLeadingDollar+ . dropPaddingSpace+ . dropWhileEnd T.null+ . fmap (T.stripEnd . T.pack)+ . lines+ $ unpackHDS docStr++foo =+ when (GHC.xopt Cpp dynFlags && not cfgTolerateCpp) $+ throwIO (OrmoluCppEnabled path)++foo =+ bar+ $ baz+ $ quux++x =+ case l of { A -> B } $+ case q of r -> s
@@ -0,0 +1,17 @@+module Main where++foo =+ bar+ $ do 1+ $ quux++abc =+ a1 $+ a2 $ do+ 3++cde =+ b1 $+ b2 $+ b3 $ \c ->+ putStrLn "foo"
@@ -0,0 +1,18 @@+module Main where++foo =+ bar $+ do 1+ $+ quux++abc =+ a1 $+ a2 $ do+ 3++cde =+ b1+ $ b2+ $ b3 $ \c ->+ putStrLn "foo"
@@ -0,0 +1,11 @@+ex1 =+ f1 $+ arg1 $+ arg2 $+ arg3++ex3 =+ f1 $+ arg1 $+ arg2 $+ 1 + 3
@@ -0,0 +1,9 @@+ex1 =+ f1 $+ arg1 $+ arg2 $ arg3++ex3 =+ f1 $+ arg1 $+ arg2 $ 1 + 3
@@ -0,0 +1,5 @@+ex2 =+ f1 $+ arg1 $+ arg2 $+ f2 arg3
@@ -0,0 +1,4 @@+ex2 =+ f1 $+ arg1 $+ arg2 $ f2 arg3
@@ -0,0 +1,11 @@+ex4 =+ f1 $+ arg1 $+ arg2 $ do+ arg3++ex6 =+ f1 $+ arg1 $+ arg2 $+ do arg3
@@ -0,0 +1,10 @@+ex4 =+ f1 $+ arg1 $+ arg2 $ do+ arg3++ex6 =+ f1 $+ arg1 $+ arg2 $ do arg3
@@ -0,0 +1,11 @@+ex5 =+ f1 $+ arg1 $+ arg2 $ \c ->+ 3 * c++ex7 =+ f1 $+ arg1 $+ arg2 $+ \c -> 3 * c
@@ -0,0 +1,10 @@+ex5 =+ f1 $+ arg1 $+ arg2 $ \c ->+ 3 * c++ex7 =+ f1 $+ arg1 $+ arg2 $ \c -> 3 * c
@@ -1,22 +0,0 @@-module Main where--foo =- fmap escapeLeadingDollar- . dropPaddingSpace- . dropWhileEnd T.null- . fmap (T.stripEnd . T.pack)- . lines- $ unpackHDS docStr--foo =- when (GHC.xopt Cpp dynFlags && not cfgTolerateCpp) $- throwIO (OrmoluCppEnabled path)--foo =- bar $- baz $- quux--x =- case l of { A -> B } $- case q of r -> s
@@ -1,22 +0,0 @@-module Main where--foo =- fmap escapeLeadingDollar- . dropPaddingSpace- . dropWhileEnd T.null- . fmap (T.stripEnd . T.pack)- . lines- $ unpackHDS docStr--foo =- when (GHC.xopt Cpp dynFlags && not cfgTolerateCpp) $- throwIO (OrmoluCppEnabled path)--foo =- bar- $ baz- $ quux--x =- case l of { A -> B } $- case q of r -> s
@@ -0,0 +1,12 @@+import Database.Esqueleto.Experimental++foo = select $ do+ t <-+ from $+ table @Bar+ `innerJoin` table @Baz+ `on` do+ \(br :& bz) -> whatever+ where_ $+ t ^. BarInt ==. val 3+ &&. t ^. BarName `in_` valList ["hello", "world"]
@@ -0,0 +1,10 @@+import Database.Esqueleto.Experimental++foo = select $ do+ t <- from $ table @Bar+ `innerJoin` table @Baz+ `on` do+ \(br :& bz) -> whatever+ where_ $+ t ^. BarInt ==. val 3+ &&. t ^. BarName `in_` valList ["hello", "world"]
@@ -0,0 +1,9 @@+import qualified Database.Esqueleto.Experimental as E++foo =+ E.from $+ E.table+ `E.innerJoin` E.table+ `E.on` ( \(a :& b) ->+ a E.^. AField E.==. b E.^. BField+ )
@@ -0,0 +1,9 @@+import qualified Database.Esqueleto.Experimental as E++foo =+ E.from $+ E.table+ `E.innerJoin` E.table+ `E.on` ( \(a :& b) ->+ a E.^. AField E.==. b E.^. BField+ )
@@ -0,0 +1,3 @@+startFormTok |~| messageTag+ >~< startMessageTok |~| name+ >~< p' |~| endMessageTok |~| endFormTok
@@ -0,0 +1,3 @@+startFormTok |~| messageTag+ >~< startMessageTok |~| name+ >~< p' |~| endMessageTok |~| endFormTok
@@ -0,0 +1,8 @@+import Test.Hspec++my_tests = do+ context "my context" $+ it "does something" $+ property $ \pos xs0 xs1 ->+ FancyError pos xs0 <> FancyError pos xs1+ `shouldBe` (FancyError pos (E.union xs0 xs1) :: PE)
@@ -0,0 +1,8 @@+import Test.Hspec++my_tests = do+ context "my context" $+ it "does something" $+ property $ \pos xs0 xs1 ->+ FancyError pos xs0 <> FancyError pos xs1+ `shouldBe` (FancyError pos (E.union xs0 xs1) :: PE)
@@ -1,3 +1,5 @@+import Control.Lens+ lenses = Just $ M.fromList $@@ -15,7 +17,8 @@ wreq = let opts =- defaults & auth ?~ awsAuth AWSv4 "key" "secret"+ defaults+ & auth ?~ awsAuth AWSv4 "key" "secret" & header "Accept" .~ ["application/json"] & header "Runscope-Bucket-Auth" .~ ["1example-1111-4yyyy-zzzz-xxxxxxxx"] in getWith opts
@@ -1,3 +1,5 @@+import Control.Lens+ lenses = Just $ M.fromList $ "type" .= ("user.connection" :: Text) # "connection" .= uc
@@ -0,0 +1,10 @@+-- chain mixing : and do-blocks+d =+ do+ 1+ : do+ 2+ : do+ 3+ : do+ 4
@@ -0,0 +1,10 @@+-- chain mixing : and do-blocks+d =+ do+ 1+ : do+ 2+ : do+ 3+ : do+ 4
@@ -0,0 +1,11 @@+-- Left chain, 2 operators with p(a) == p(b)+s :: Int+s =+ 1+ + 2+ + 3+ + 4+ - 5+ + 6+ + 7+ + 8
@@ -0,0 +1,11 @@+-- Left chain, 2 operators with p(a) == p(b)+s :: Int+s =+ 1 ++ 2 ++ 3 ++ 4 -+ 5 ++ 6 ++ 7 ++ 8
@@ -0,0 +1,11 @@+-- Left chain, 2 operators with p(a) > p(b)+t :: Int+t =+ 1+ + 2+ + 3+ + 4+ >> 5+ + 6+ + 7+ + 8
@@ -0,0 +1,11 @@+-- Left chain, 2 operators with p(a) > p(b)+t :: Int+t =+ 1 ++ 2 ++ 3 ++ 4 >>+ 5 ++ 6 ++ 7 ++ 8
@@ -0,0 +1,11 @@+-- Left chain, 2 operators with p(a) < p(b)+u :: Int+u =+ 1+ + 2+ + 3+ + 4+ * 5+ + 6+ + 7+ + 8
@@ -0,0 +1,11 @@+-- Left chain, 2 operators with p(a) < p(b)+u :: Int+u =+ 1 ++ 2 ++ 3 ++ 4 *+ 5 ++ 6 ++ 7 ++ 8
@@ -0,0 +1,7 @@+-- Left chain, 1 operator type+r :: Int+r =+ 1+ + 2+ + 3+ + 4
@@ -0,0 +1,7 @@+-- Left chain, 1 operator type+r :: Int+r =+ 1 ++ 2 ++ 3 ++ 4
@@ -0,0 +1,11 @@+-- Right chain, : case, 2 operators with p(:) == p(b)+h :: Int+h =+ 1+ : 2+ : 3+ : 4+ ++ 5+ : 6+ : 7+ : 8
@@ -0,0 +1,11 @@+-- Right chain, : case, 2 operators with p(:) == p(b)+h :: Int+h =+ 1 :+ 2 :+ 3 :+ 4 +++ 5 :+ 6 :+ 7 :+ 8
@@ -0,0 +1,11 @@+-- Right chain, : case, 2 operators with p(a) == p(:)+k :: Int+k =+ 1+ ++ 2+ ++ 3+ ++ 4+ : 5+ ++ 6+ ++ 7+ ++ 8
@@ -0,0 +1,11 @@+-- Right chain, : case, 2 operators with p(a) == p(:)+k :: Int+k =+ 1 +++ 2 +++ 3 +++ 4 :+ 5 +++ 6 +++ 7 +++ 8
@@ -0,0 +1,11 @@+-- Right chain, $ case, 2 operators with p($) == p(b)+n :: Int+n =+ 1 $+ 2 $+ 3 $+ 4 `seq`+ 5 $+ 6 $+ 7 $+ 8
@@ -0,0 +1,11 @@+-- Right chain, $ case, 2 operators with p($) == p(b)+n :: Int+n =+ 1 $+ 2 $+ 3 $+ 4 `seq`+ 5 $+ 6 $+ 7 $+ 8
@@ -0,0 +1,11 @@+-- Right chain, $ case, 2 operators with p(a) == p($)+p :: Int+p =+ 1 `seq`+ 2 `seq`+ 3 `seq`+ 4 $+ 5 `seq`+ 6 `seq`+ 7 `seq`+ 8
@@ -0,0 +1,11 @@+-- Right chain, $ case, 2 operators with p(a) == p($)+p :: Int+p =+ 1 `seq`+ 2 `seq`+ 3 `seq`+ 4 $+ 5 `seq`+ 6 `seq`+ 7 `seq`+ 8
@@ -0,0 +1,11 @@+-- Right chain, normal case, 2 operators with p(a) == p(b)+e :: Int+e =+ 1+ ^^ 2+ ^^ 3+ ^^ 4+ ^ 5+ ^^ 6+ ^^ 7+ ^^ 8
@@ -0,0 +1,11 @@+-- Right chain, normal case, 2 operators with p(a) == p(b)+e :: Int+e =+ 1 ^^+ 2 ^^+ 3 ^^+ 4 ^+ 5 ^^+ 6 ^^+ 7 ^^+ 8
@@ -0,0 +1,11 @@+-- Right chain, : case, 2 operators with p(:) > p(b)+i :: Int+i =+ 1+ : 2+ : 3+ : 4+ `seq` 5+ : 6+ : 7+ : 8
@@ -0,0 +1,11 @@+-- Right chain, : case, 2 operators with p(:) > p(b)+i :: Int+i =+ 1 :+ 2 :+ 3 :+ 4 `seq`+ 5 :+ 6 :+ 7 :+ 8
@@ -0,0 +1,11 @@+-- Right chain, : case, 2 operators with p(a) > p(:)+l :: Int+l =+ 1+ ^^ 2+ ^^ 3+ ^^ 4+ : 5+ ^^ 6+ ^^ 7+ ^^ 8
@@ -0,0 +1,11 @@+-- Right chain, : case, 2 operators with p(a) > p(:)+l :: Int+l =+ 1 ^^+ 2 ^^+ 3 ^^+ 4 :+ 5 ^^+ 6 ^^+ 7 ^^+ 8
@@ -0,0 +1,11 @@+-- Right chain, $ case, 2 operators with p(a) > p($)+q :: Int+q =+ 1+ ++ 2+ ++ 3+ ++ 4+ $ 5+ ++ 6+ ++ 7+ ++ 8
@@ -0,0 +1,11 @@+-- Right chain, $ case, 2 operators with p(a) > p($)+q :: Int+q =+ 1 +++ 2 +++ 3 +++ 4 $+ 5 +++ 6 +++ 7 +++ 8
@@ -0,0 +1,11 @@+-- Right chain, normal case, 2 operators with p(a) > p(b)+f :: Int+f =+ 1+ ^^ 2+ ^^ 3+ ^^ 4+ ++ 5+ ^^ 6+ ^^ 7+ ^^ 8
@@ -0,0 +1,11 @@+-- Right chain, normal case, 2 operators with p(a) > p(b)+f :: Int+f =+ 1 ^^+ 2 ^^+ 3 ^^+ 4 +++ 5 ^^+ 6 ^^+ 7 ^^+ 8
@@ -0,0 +1,11 @@+-- Right chain, : case, 2 operators with p(:) < p(b)+j :: Int+j =+ 1+ : 2+ : 3+ : 4+ ^^ 5+ : 6+ : 7+ : 8
@@ -0,0 +1,11 @@+-- Right chain, : case, 2 operators with p(:) < p(b)+j :: Int+j =+ 1 :+ 2 :+ 3 :+ 4 ^^+ 5 :+ 6 :+ 7 :+ 8
@@ -0,0 +1,11 @@+-- Right chain, : case, 2 operators with p(a) < p(:)+m :: Int+m =+ 1+ || 2+ || 3+ || 4+ : 5+ || 6+ || 7+ || 8
@@ -0,0 +1,11 @@+-- Right chain, : case, 2 operators with p(a) < p(:)+m :: Int+m =+ 1 ||+ 2 ||+ 3 ||+ 4 :+ 5 ||+ 6 ||+ 7 ||+ 8
@@ -0,0 +1,11 @@+-- Right chain, $ case, 2 operators with p($) < p(b)+o :: Int+o =+ 1+ $ 2+ $ 3+ $ 4+ ++ 5+ $ 6+ $ 7+ $ 8
@@ -0,0 +1,11 @@+-- Right chain, $ case, 2 operators with p($) < p(b)+o :: Int+o =+ 1 $+ 2 $+ 3 $+ 4 +++ 5 $+ 6 $+ 7 $+ 8
@@ -0,0 +1,11 @@+-- Right chain, normal case, 2 operators with p(a) < p(b)+g :: Int+g =+ 1+ ++ 2+ ++ 3+ ++ 4+ ^^ 5+ ++ 6+ ++ 7+ ++ 8
@@ -0,0 +1,11 @@+-- Right chain, normal case, 2 operators with p(a) < p(b)+g :: Int+g =+ 1 +++ 2 +++ 3 +++ 4 ^^+ 5 +++ 6 +++ 7 +++ 8
@@ -0,0 +1,7 @@+-- Right chain, : case, 1 operator type+b :: Int+b =+ 1+ : 2+ : 3+ : 4
@@ -0,0 +1,7 @@+-- Right chain, : case, 1 operator type+b :: Int+b =+ 1 :+ 2 :+ 3 :+ 4
@@ -0,0 +1,7 @@+-- Right chain, $ case, 1 operator type+c :: Int+c =+ 1 $+ 2 $+ 3 $+ 4
@@ -0,0 +1,7 @@+-- Right chain, $ case, 1 operator type+c :: Int+c =+ 1 $+ 2 $+ 3 $+ 4
@@ -0,0 +1,7 @@+-- Right chain, normal case, 1 operator type+a :: Int+a =+ 1+ ++ 2+ ++ 3+ ++ 4
@@ -0,0 +1,7 @@+-- Right chain, normal case, 1 operator type+a :: Int+a =+ 1 +++ 2 +++ 3 +++ 4
@@ -0,0 +1,9 @@+lenses =+ Just $+ M.fromList $+ "type" Foo..= ("user.connection" :: Text)+ Bar.# "connection" Foo..= uc+ Bar.# "user" Foo..= case name of+ Just n -> Just $ object ["name" .= n]+ Nothing -> Nothing+ Bar.# []
@@ -0,0 +1,7 @@+lenses = Just $ M.fromList+ $ "type" Foo..= ("user.connection" :: Text)+ Bar.# "connection" Foo..= uc+ Bar.# "user" Foo..= case name of+ Just n -> Just $ object ["name" .= n]+ Nothing -> Nothing+ Bar.# []
@@ -0,0 +1,12 @@+module StreamSpec where++import Prelude (($))+import qualified Prelude++spec :: Spec+spec = do+ describe "Comparing list function to" $ do+ qit "yieldMany" $+ \(mono :: Seq Int) ->+ yieldMany mono+ `checkProducer` otoList mono
@@ -0,0 +1,12 @@+module StreamSpec where++import qualified Prelude+import Prelude (($))++spec :: Spec+spec = do+ describe "Comparing list function to" $ do+ qit "yieldMany" $+ \(mono :: Seq Int) ->+ yieldMany mono `checkProducer`+ otoList mono
@@ -0,0 +1,9 @@+b :: [Int]+b =+ 1+ : do+ 2+ : do+ 3+ : do+ [4]
@@ -0,0 +1,9 @@+b :: [Int]+b =+ 1 :+ do+ 2+ : do+ 3+ : do+ [4]
@@ -7,3 +7,17 @@ 5 -> 10 i | i > 5 -> 11 _ -> 12++foo :: Maybe a -> Maybe a -> Maybe a -> Int+foo = \cases Nothing Just {} Nothing -> 1; _ _ _ -> 0++foo :: Maybe Int -> Maybe Int -> Int+foo = \cases+ (Just a) (Just a) -> a + a+ _ _ -> 0++foo :: Bool -> Bool -> Bool+foo = \cases+ True+ True -> True+ _ _ -> False
@@ -7,3 +7,17 @@ 5 -> 10 i | i > 5 -> 11 _ -> 12++foo :: Maybe a -> Maybe a -> Maybe a -> Int+foo = \cases Nothing Just{} Nothing -> 1; _ _ _ -> 0++foo :: Maybe Int -> Maybe Int -> Int+foo = \cases+ (Just a) (Just a) -> a + a+ _ _ -> 0++foo :: Bool -> Bool -> Bool+foo = \cases+ True+ True -> True+ _ _ -> False
@@ -17,7 +17,7 @@ () -> undefined in go -implicitParams :: HasCallStack => Int+implicitParams :: (HasCallStack) => Int implicitParams = let ?cs = ?callstack in foo cs
@@ -0,0 +1,9 @@+{-# LANGUAGE LinearTypes #-}++h x = g y+ where+ %1 y = f x++let %1 x = u in ()+let %Many (x, y) = u in ()+let %1 ~(x, y) = u in ()
@@ -0,0 +1,9 @@+{-# Language LinearTypes #-}++h x = g y+ where+ %1 y = f x++let %1 x = u in ()+let %Many (x, y) = u in ()+let %1 ~(x, y) = u in ()
@@ -4,21 +4,40 @@ barbaz x y z w = [ (a, b, c, d) -- Foo- | a <-- x, -- Bar- b <- y, -- Baz- any even [a, b],- c <-- z- * z ^ 2, -- Bar baz- d <-- w- + w, -- Baz bar- all- even- [ a,- b,- c,- d- ]+ | a <-+ x, -- Bar+ b <- y, -- Baz+ any even [a, b],+ c <-+ z+ * z ^ 2, -- Bar baz+ d <-+ w+ + w, -- Baz bar+ all+ even+ [ a,+ b,+ c,+ d+ ]+ ]++a = do+ d <-+ [ x + 1+ | x <- b+ ]++ [ c+ | c <- d+ ]++trans =+ [ x+ | x <- xs,+ then+ reverse,+ then+ reverse ]
@@ -20,3 +20,19 @@ c, d ] ]++a = do+ d <-+ [ x + 1+ | x <- b+ ]++ [ c+ | c <- d ]++trans =+ [ x+ | x <- xs+ , then reverse+ , then reverse+ ]
@@ -1,5 +1,5 @@ foo =- testCase "Foo" testFoo :- testCase "Bar" testBar :- testCase "Baz" testBaz :- []+ testCase "Foo" testFoo+ : testCase "Bar" testBar+ : testCase "Baz" testBaz+ : []
@@ -1,8 +1,8 @@ instance A.ToJSON UpdateTable where toJSON a = A.object $- "TableName" .= updateTableName a :- "ProvisionedThroughput" .= updateProvisionedThroughput a :- case updateGlobalSecondaryIndexUpdates a of- [] -> []- l -> ["GlobalSecondaryIndexUpdates" .= l]+ "TableName" .= updateTableName a+ : "ProvisionedThroughput" .= updateProvisionedThroughput a+ : case updateGlobalSecondaryIndexUpdates a of+ [] -> []+ l -> ["GlobalSecondaryIndexUpdates" .= l]
@@ -1,6 +1,6 @@ -- A list of the element and all its parents up to the root node. getPath tree t =- t :- case Map.lookup (getId t) tree of- Nothing -> []- Just parent -> getPath tree parent+ t+ : case Map.lookup (getId t) tree of+ Nothing -> []+ Just parent -> getPath tree parent
@@ -1,12 +1,10 @@ foo =- reportSDoc "tc.cc" 30 $- sep $ do- (prettyTCM q <+> " before compilation") : do- map (prettyTCM . map unArg . clPats) cls+ reportSDoc "tc.cc" 30 $ sep $ do+ (prettyTCM q <+> " before compilation") : do+ map (prettyTCM . map unArg . clPats) cls foo =- reportSDoc "tc.cc" 30 $- sep $ do- (prettyTCM q <+> " before compilation") :- do- map (prettyTCM . map unArg . clPats) cls+ reportSDoc "tc.cc" 30 $ sep $ do+ (prettyTCM q <+> " before compilation")+ : do+ map (prettyTCM . map unArg . clPats) cls
@@ -4,13 +4,15 @@ bar x y = if- | x > y -> x- | x < y ->+ | x > y -> x+ | x < y -> y- | otherwise -> x+ | otherwise -> x baz = if | p -> f | otherwise -> g x++x y = if | foo -> False | otherwise -> True
@@ -12,3 +12,5 @@ if | p -> f | otherwise -> g x++x y = if | foo -> False | otherwise -> True
@@ -0,0 +1,29 @@+{-# LANGUAGE MultilineStrings #-}++s =+ """Line 1+ Line 2+ Line 3+ """++s_2 =+ """\ \Line 1+ Line 2+ Line 3+ """++-- equivalent to+s' = "Line 1\n Line 2\nLine 3"++-- the following are equivalent+s = """hello world"""++s' = "hello world"++s =+ """ hello+ world+ """++-- equivalent to+s' = " hello\nworld"
@@ -0,0 +1,31 @@+{-# LANGUAGE MultilineStrings #-}++s =+ """Line 1+ Line 2+ Line 3+ """++s_2 =+ """\+ \Line 1+ Line 2+ Line 3+ """++-- equivalent to+s' = "Line 1\n Line 2\nLine 3"+++-- the following are equivalent+s = """hello world"""+s' = "hello world"+++s =+ """ hello+ world+ """++-- equivalent to+s' = " hello\nworld"
@@ -0,0 +1,12 @@+{-# LANGUAGE MultilineStrings #-}++s =+ """+ a b\ \ c d e+ f g+ """++-- equivalent to+s' = "a b c d e\nf g"++weirdGap = """\65\ \0"""
@@ -0,0 +1,13 @@+{-# LANGUAGE MultilineStrings #-}++s =+ """+ a b\+ \ c d e+ f g+ """++-- equivalent to+s' = "a b c d e\nf g"++weirdGap = """\65\ \0"""
@@ -0,0 +1,11 @@+{-# LANGUAGE MultilineStrings #-}++s =+ """+ a+ b+ c+ """++-- equivalent to+s' = "a\nb\nc"
@@ -0,0 +1,11 @@+{-# LANGUAGE MultilineStrings #-}++s =+ """+ a+ b+ c+ """++-- equivalent to+s' = "a\nb\nc"
@@ -0,0 +1,32 @@+{-# LANGUAGE MultilineStrings #-}++s =+ """++ a+ b+ c+ """++-- equivalent to+s' = "\na\nb\nc"++s1 =+ """ a+ b+ c+ """++s2 =+ """+ a+ b+ c+ """++-- In the current proposal, these are equivalent to+-- the below. If leading newline were removed at the+-- beginning, both would result in s1'.+s1' = " a\nb\nc"++s2' = "a\nb\nc"
@@ -0,0 +1,32 @@+{-# LANGUAGE MultilineStrings #-}++s =+ """++ a+ b+ c+ """++-- equivalent to+s' = "\na\nb\nc"+++s1 =+ """ a+ b+ c+ """++s2 =+ """+ a+ b+ c+ """++-- In the current proposal, these are equivalent to+-- the below. If leading newline were removed at the+-- beginning, both would result in s1'.+s1' = " a\nb\nc"+s2' = "a\nb\nc"
@@ -0,0 +1,25 @@+{-# LANGUAGE MultilineStrings #-}++s =+ """+ a+ b++ """++-- equivalent to+s' = "a\nb\n"++s1 =+ """+ line 1+ line 2+ """++s2 = "line 3"++s3 =+ """+ line 4+ line 5+ """
@@ -0,0 +1,26 @@+{-# LANGUAGE MultilineStrings #-}++s =+ """+ a+ b++ """++-- equivalent to+s' = "a\nb\n"+++s1 =+ """+ line 1+ line 2+ """++s2 = "line 3"++s3 =+ """+ line 4+ line 5+ """
@@ -0,0 +1,26 @@+{-# LANGUAGE MultilineStrings #-}++s1 =+ """+ a+ b+ c+ """++s1' = "a\nb\nc"++s2 =+ """+ \& a+ b+ c+ """++s2_2 =+ """+ \& a+ \& b+ \& c+ """++s2' = " a\n b\n c"
@@ -0,0 +1,26 @@+{-# LANGUAGE MultilineStrings #-}++s1 =+ """+ a+ b+ c+ """++s1' = "a\nb\nc"++s2 =+ """+ \& a+ b+ c+ """++s2_2 =+ """+ \& a+ \& b+ \& c+ """++s2' = " a\n b\n c"
@@ -0,0 +1,10 @@+{-# LANGUAGE MultilineStrings #-}++x =+ """+ This is a literal multiline string:+ \"\"\"+ Hello+ world!+ \"""+ """
@@ -0,0 +1,10 @@+{-# LANGUAGE MultilineStrings #-}++x =+ """+ This is a literal multiline string:+ \"\"\"+ Hello+ world!+ \"""+ """
@@ -0,0 +1,30 @@+{-# LANGUAGE MultilineStrings #-}++printf+ """+ instance Aeson.FromJSON %s where+ parseJSON =+ Aeson.withText "%s" $ \\s ->+ either Aeson.parseFail pure $+ parsePrinterOptType (Text.unpack s)++ instance PrinterOptsFieldType %s where+ parsePrinterOptType s =+ case s of+ %s+ _ ->+ Left . unlines $+ [ "unknown value: " <> show s+ , "Valid values are: %s"+ ]++ """+ fieldTypeName+ fieldTypeName+ fieldTypeName+ ( unlines_+ [ printf " \"%s\" -> Right %s" val con+ | (con, val) <- enumOptions+ ]+ )+ (renderEnumOptions enumOptions)
@@ -0,0 +1,30 @@+{-# LANGUAGE MultilineStrings #-}++printf+ """+ instance Aeson.FromJSON %s where+ parseJSON =+ Aeson.withText "%s" $ \\s ->+ either Aeson.parseFail pure $+ parsePrinterOptType (Text.unpack s)++ instance PrinterOptsFieldType %s where+ parsePrinterOptType s =+ case s of+ %s+ _ ->+ Left . unlines $+ [ "unknown value: " <> show s+ , "Valid values are: %s"+ ]++ """+ fieldTypeName+ fieldTypeName+ fieldTypeName+ ( unlines_+ [ printf " \"%s\" -> Right %s" val con+ | (con, val) <- enumOptions+ ]+ )+ (renderEnumOptions enumOptions)
@@ -0,0 +1,12 @@+{-# LANGUAGE MultilineStrings #-}++type Foo =+ """+ yeah+ yeah"""++foo =+ foo+ @"""yeah+ yeah+ """
@@ -0,0 +1,9 @@+{-# LANGUAGE MultilineStrings #-}++type Foo = """+ yeah+ yeah"""++foo = foo @"""yeah+ yeah+ """
@@ -0,0 +1,11 @@+{-# LANGUAGE MultilineStrings #-}++multilineBlank =+ """+ 1+++++ 6+ """
@@ -0,0 +1,11 @@+{-# LANGUAGE MultilineStrings #-}++multilineBlank =+ """+ 1+++++ 6+ """
@@ -0,0 +1,17 @@+foo ::+ (Monad m, Show a) =>+ a ->+ m String+bar ::+ ( Monad m,+ Show a+ ) =>+ a -> m String+multiConstraints ::+ (Show a) =>+ a ->+ a ->+ a ->+ (Eq a) =>+ (Num a) =>+ a -> a -> ()
@@ -0,0 +1,15 @@+foo ::+ (Monad m, Show a) =>+ a ->+ m String++bar ::+ (Monad m,+ Show a) =>+ a -> m String++multiConstraints ::+ Show a =>+ a -> a -> a ->+ Eq a => Num a =>+ a -> a -> ()
@@ -6,9 +6,9 @@ bar :: Int -> Int bar x | x == 5 =- foo x- + foo 10+ foo x+ + foo 10 | x == 6 =- foo x- + foo 20+ foo x+ + foo 20 | otherwise = foo 100
@@ -1,7 +1,6 @@ foo :: Int -> Int-foo x- | x == 5 = 10- | otherwise = 12+foo x | x == 5 = 10+ | otherwise = 12 bar :: Int -> Int bar x
@@ -0,0 +1,12 @@+def1 =+ (,,)+ <$> gvar (primitiveGVar "natToHex")+ `foo` ne+ <*> con cNothing+ `foo` tcon tChar++def2 =+ tds1+ && lc1 == mempty+ && gc1 `M.isSubmapOf` gc2+ && sh1 == sh2
@@ -0,0 +1,12 @@+def1 =+ (,,)+ <$> gvar (primitiveGVar "natToHex")+ `foo` ne+ <*> con cNothing+ `foo` tcon tChar++def2 =+ tds1+ && lc1 == mempty+ && gc1 `M.isSubmapOf` gc2+ && sh1 == sh2
@@ -0,0 +1,8 @@+{-# LANGUAGE UnboxedSums #-}++module Foo (( #<| )) where++( #<| ) :: Int -> Int -> Int+( #<| ) = (+)++(+) = (+)
@@ -0,0 +1,8 @@+{-# LANGUAGE UnboxedSums #-}++module Foo (( #<| )) where++( #<| ) :: Int -> Int -> Int+( #<| ) = (+)++(+) = (+)
@@ -0,0 +1,6 @@+module Foo ((#<|)) where++(#<|) :: Int -> Int -> Int+(#<|) = (+)++(+) = (+)
@@ -0,0 +1,6 @@+module Foo (( #<| )) where++( #<| ) :: Int -> Int -> Int+( #<| ) = (+)++(+) = (+)
@@ -1,5 +1,8 @@+import Control.Lens.Operators+ a =- b & c .~ d+ b+ & c .~ d & e %~ f g
@@ -1,3 +1,5 @@+import Control.Lens.Operators+ a = b & c .~ d & e %~ f
@@ -1,4 +1,6 @@ foo n- | x || y && z || n ** x+ | x+ || y && z+ || n ** x || x && n =- 42+ 42
@@ -1,3 +1,8 @@+import Control.Arrow+ foo =- op <> n <+> colon <+> prettySe <+> text "="+ op <> n+ <+> colon+ <+> prettySe+ <+> text "=" <+> prettySe <> text sc
@@ -1,3 +1,5 @@+import Control.Arrow+ foo = op <> n <+> colon <+> prettySe <+> text "=" <+> prettySe <> text sc
@@ -1,3 +1,8 @@+import Control.Arrow+ foo =- line <> bindingOf <+> text "=" <+> tPretty <+> colon+ line <> bindingOf+ <+> text "="+ <+> tPretty+ <+> colon <+> align <> prettyPs
@@ -1,3 +1,5 @@+import Control.Arrow+ foo = line <> bindingOf <+> text "=" <+> tPretty <+> colon <+> align <> prettyPs
@@ -1,3 +1,5 @@+import Servant.API+ type PermuteRef = "a" :> ( "b" :> "c" :> End
@@ -1,3 +1,5 @@+import Servant.API+ type PermuteRef = "a" :> ( "b" :> "c" :> End :<|> "c" :> "b" :> End
@@ -0,0 +1,1 @@+foo c = case c of { _ -> c } : []
@@ -0,0 +1,1 @@+foo c = case c of {_->c} : []
@@ -3,3 +3,36 @@ foo = #field bar = (#this) (#that)++baz = #Foo #"Hello world!" #"\"" #3 #"\n"++-- from https://gitlab.haskell.org/ghc/ghc/-/blob/ghc-9.6.1-alpha3/testsuite/tests/overloadedrecflds/should_run/T11671_run.hs+-- unnecessary once https://github.com/tweag/ormolu/issues/821 lands+main =+ traverse_+ putStrLn+ [ #a,+ #number17,+ #do,+ #type,+ #Foo,+ #3,+ #"199.4",+ #17a23b,+ #f'a',+ #'a',+ #',+ #''notTHSplice,+ #"...",+ #привет,+ #こんにちは,+ #"3",+ #":",+ #"Foo",+ #"The quick brown fox",+ #"\"",+ (++) #hello #world,+ (++) #"hello" #"world",+ #"hello" # 1, -- equivalent to `(fromLabel @"hello") # 1`+ f "hello" #2 -- equivalent to `f ("hello"# :: Addr#) 2`+ ]
@@ -2,3 +2,33 @@ foo = #field bar = (#this ) ( #that)+baz = #Foo #"Hello world!" #"\"" #3 #"\n"++-- from https://gitlab.haskell.org/ghc/ghc/-/blob/ghc-9.6.1-alpha3/testsuite/tests/overloadedrecflds/should_run/T11671_run.hs+-- unnecessary once https://github.com/tweag/ormolu/issues/821 lands+main = traverse_ putStrLn+ [ #a+ , #number17+ , #do+ , #type+ , #Foo+ , #3+ , #"199.4"+ , #17a23b+ , #f'a'+ , #'a'+ , #'+ , #''notTHSplice+ , #"..."+ , #привет+ , #こんにちは+ , #"3"+ , #":"+ , #"Foo"+ , #"The quick brown fox"+ , #"\""+ , (++) #hello#world+ , (++) #"hello"#"world"+ , #"hello"# 1 -- equivalent to `(fromLabel @"hello") # 1`+ , f "hello"#2 -- equivalent to `f ("hello"# :: Addr#) 2`+ ]
@@ -10,26 +10,26 @@ i, j )- | a <- -- Foo 1- x, -- Foo 2- b <- -- Bar 1- y, -- Bar 2+ | a <- -- Foo 1+ x, -- Foo 2+ b <- -- Bar 1+ y, -- Bar 2+ a+ `mod` b -- Value+ == 0+ | c <- -- Baz 1+ z+ * z -- Baz 2+ -- Baz 3+ | d <- w -- Other+ | e <- x * x -- Foo bar+ | f <- -- Foo baz 1+ y + y -- Foo baz 2+ | h <- z + z * w ^ 2 -- Bar foo+ | i <- -- Bar bar 1 a- `mod` b -- Value- == 0- | c <- -- Baz 1- z- * z -- Baz 2- -- Baz 3- | d <- w -- Other- | e <- x * x -- Foo bar- | f <- -- Foo baz 1- y + y -- Foo baz 2- | h <- z + z * w ^ 2 -- Bar foo- | i <- -- Bar bar 1- a- + b, -- Bar bar 2- -- Bar bar 3- j <- -- Bar baz 1- a + b -- Bar baz 2+ + b, -- Bar bar 2+ -- Bar bar 3+ j <- -- Bar baz 1+ a + b -- Bar baz 2 ]
@@ -0,0 +1,4 @@+test =+ ( -- a+ x+ )
@@ -0,0 +1,3 @@+test = (+ -- a+ x)
@@ -0,0 +1,3 @@+foobar x | x <- 5 = 5 | x <- 6 = 6 | otherwise = 7++foobaz | x <- 5 = 5 | x <- 6 = 6 | otherwise = 7
@@ -0,0 +1,3 @@+foobar x | x <- 5 = 5 | x <- 6 = 6 | otherwise = 7++foobaz | x <- 5 = 5 | x <- 6 = 6 | otherwise = 7
@@ -0,0 +1,6 @@+foobarbar :: Int -> Bool+foobarbar+ | x <-+ 5 = case x of+ 5 -> True+ _ -> False
@@ -0,0 +1,5 @@+foobarbar :: Int -> Bool+foobarbar | x <-+ 5 = case x of+ 5 -> True+ _ -> False
@@ -0,0 +1,6 @@+foobarbar :: Int -> Bool+foobarbar+ | x <- 5,+ y <- 6 = case x of+ 5 -> True+ _ -> False
@@ -0,0 +1,4 @@+foobarbar :: Int -> Bool+foobarbar | x <- 5, y <- 6 = case x of+ 5 -> True+ _ -> False
@@ -0,0 +1,44 @@+{-# LANGUAGE PatternSynonyms #-}++tasty (Cupcake; Cookie) = True+tasty (Liquorice; Raisins) = False++f :: (Eq a, Show a) => a -> a -> Bool+f a ((== a) -> True; show -> "yes") = True+f _ _ = False++small (abs -> (0; 1; 2); 3) = True -- -3 is not small+small _ = False++type Coll a = Either [a] (Set a)++pattern None <- (Left []; Right (toList -> []))++case e of+ 1; 2; 3 -> x+ 4; (5; 6) -> y++sane e = case e of+ 1+ 2+ 3 ->+ a+ 4+ 5+ 6 -> b+ 7; 8 -> c++insane e = case e of+ A _ _+ B _+ C -> 3+ (D; E (Just _) Nothing) ->+ 4+ F -> 5++food+ foo@( A;+ B;+ C+ ) = Just foo+food _ = Nothing
@@ -0,0 +1,39 @@+{-# LANGUAGE PatternSynonyms #-}++tasty (Cupcake; Cookie) = True+tasty (Liquorice; Raisins) = False++f :: (Eq a, Show a) => a -> a -> Bool+f a ((== a) -> True; show -> "yes") = True+f _ _ = False++small (abs -> (0; 1; 2); 3) = True -- -3 is not small+small _ = False++type Coll a = Either [a] (Set a)+pattern None <- (Left []; Right (toList -> []))++case e of+ 1; 2; 3 -> x+ 4; (5; 6) -> y++sane e = case e of+ 1+ 2+ 3 ->+ a+ 4+ 5;6 -> b+ 7;8 -> c++insane e = case e of+ A _ _; B _+ C -> 3+ (D; E (Just _) Nothing)+ -> 4+ F -> 5++food foo@(A;+ B;+ C) = Just foo+food _ = Nothing
@@ -1,8 +1,13 @@-sccfoo = {-# SCC foo #-} 1+sccfoo = {-# SCC "foo" #-} 1 sccbar = {-# SCC "barbaz" #-} "hello"++foo = do+ {-# SCC "foo" #-}+ fmap succ $ do+ {-# SCC "bar" #-} pure 1 -- CORE pragma got removed in https://gitlab.haskell.org/ghc/ghc/-/commit/12f9035200424ec8104484f154a040d612fee99d
@@ -2,6 +2,10 @@ sccbar = {-# SCC "barbaz"#-} "hello" +foo = do+ {-# SCC "foo" #-} fmap succ $ do+ {-# SCC "bar" #-} pure 1+ -- CORE pragma got removed in https://gitlab.haskell.org/ghc/ghc/-/commit/12f9035200424ec8104484f154a040d612fee99d corefoo = {-# CORE "foo"#-} 1
@@ -0,0 +1,10 @@+{-# LANGUAGE ExtendedLiterals #-}+{-# LANGUAGE MagicHash #-}++foo = 1#++bar = 2##++baz = 3#Word32++baz = 0b1010#Int64
@@ -0,0 +1,9 @@+{-# LANGUAGE ExtendedLiterals, MagicHash #-}++foo = 1#++bar = 2##++baz = 3#Word32++baz = 0b1010#Int64
@@ -1,15 +0,0 @@-{-# OPTIONS_GHC -fplugin=RecordDotPreprocessor #-}--bar' =- (Foo 1){bar = 2- }--fooplus'''' f n =- f{foo = n,- bar = n- }--fooplus''''' f n =- f- { foo = n- }
@@ -1,10 +0,0 @@-{-# OPTIONS_GHC -fplugin=RecordDotPreprocessor #-}-bar' = (Foo 1){bar = 2- }--fooplus'''' f n = f{foo = n,- bar = n- }--fooplus''''' f n = f- { foo = n }
@@ -1,15 +0,0 @@-{-# OPTIONS_GHC -fplugin=RecordDotPreprocessor #-}--data Foo = Foo {bar :: Int}--mfoo = fmap (.bar) $ Nothing--bar = (Foo 1).bar--fooplus f n = f{foo = f.bar + n}--fooplus' f n = f {foo = f.bar + n}--fooplus'' f n = f {foo = f.bar + n}--fooplus''' f n = f {foo = f.bar + n}
@@ -1,14 +0,0 @@-{-# OPTIONS_GHC -fplugin=RecordDotPreprocessor #-}-data Foo = Foo { bar :: Int }--mfoo = fmap (.bar) $ Nothing--bar = ( Foo 1).bar--fooplus f n = f{foo = f.bar + n}--fooplus' f n = f { foo = f.bar + n}--fooplus'' f n = f {foo = f.bar + n}--fooplus''' f n = f{ foo = f.bar + n}
@@ -0,0 +1,16 @@+{-# LANGUAGE OverloadedRecordDot #-}+{-# LANGUAGE OverloadedRecordUpdate #-}++data Foo = Foo {bar :: Foo}++mfoo = fmap (.bar) $ Nothing++bar = (Foo 1).bar++fooplus f n = f {foo = f.bar + n}++nestedFoo f = f.bar.bar.bar.bar.bar++nestedFooUpdate f = f {bar.bar = f.bar} <> f {bar.bar.bar.bar}++operatorUpdate f = f {(+) = 1}
@@ -0,0 +1,16 @@+{-# LANGUAGE OverloadedRecordDot #-}+{-# LANGUAGE OverloadedRecordUpdate #-}++data Foo = Foo { bar :: Foo }++mfoo = fmap (.bar) $ Nothing++bar = ( Foo 1).bar++fooplus f n = f{foo = f.bar + n}++nestedFoo f = f.bar.bar.bar.bar.bar++nestedFooUpdate f = f {bar.bar = f.bar } <> f {bar.bar.bar.bar}++operatorUpdate f = f { (+) = 1 }
@@ -0,0 +1,23 @@+{-# LANGUAGE LinearTypes #-}+{-# LANGUAGE UnicodeSyntax #-}++ex1 = f (forall a. Proxy a)++ex2 = f ((ctx) => Int)++ex2' = f ((ctx, ctx') => Int)++ex3 = f (String -> Bool)++long =+ f+ ( forall m a.+ (A a, M m) =>+ String ->+ Bool %1 ->+ Maybe Int ->+ Maybe+ (String, Int) %1 ->+ Word %m ->+ Text+ )
@@ -0,0 +1,14 @@+{-# LANGUAGE UnicodeSyntax #-}+{-# LANGUAGE LinearTypes #-}++ex1 = f (forall a. Proxy a)+ex2 = f (ctx => Int)+ex2' = f ((ctx,ctx') => Int)+ex3 = f (String -> Bool)++long = f (forall m a. (A a, M m) => String+ -> Bool %1 ->+ Maybe Int+ -> Maybe+ (String,Int)+ ⊸ Word %m -> Text )
@@ -0,0 +1,21 @@+vshow :: forall a -> (Show a) => a -> String+vshow t x = show (x :: t)++s1 = vshow Int 42++s2 = vshow Double 42++a1 = f (type (Int -> Bool))++a2 = f (type ((Read T) => T))++a3 = f (type (forall a. a))++a4 = f (type (forall a. (Read a) => String -> a))++foo =+ f+ ( type ( Maybe+ Int+ )+ )
@@ -0,0 +1,13 @@+vshow :: forall a -> Show a => a -> String+vshow t x = show (x :: t)++s1 = vshow Int 42+s2 = vshow Double 42++a1 = f (type (Int -> Bool))+a2 = f (type (Read T => T))+a3 = f (type (forall a. a))+a4 = f (type (forall a. Read a => String -> a))++foo = f (type (Maybe+ Int))
@@ -2,9 +2,13 @@ foo = "foobar" -bar = "foo\&barbaz"+bar = "foo\&bar\ \baz" baz = "foo\ \bar\ \baz"++weirdGap = "\65\ \0"++weirdEscape = "\^\ "
@@ -5,3 +5,7 @@ baz = "foo\ \bar\ \baz"++weirdGap = "\65\ \0"++weirdEscape = "\^\ "
@@ -0,0 +1,9 @@+id :: forall a. a -> a+id @t x = x :: t++f1 :: forall a. a -> forall b. b -> (a, b)+f1 @a x @b y = (x :: a, y :: b)++f2 =+ (\ @a x @b y -> (x :: a, y :: b)) ::+ forall a. a -> forall b. b -> (a, b)
@@ -0,0 +1,8 @@+id :: forall a. a -> a+id @t x = x :: t++f1 :: forall a. a -> forall b. b -> (a, b)+f1 @a x @b y = (x :: a, y :: b)++f2 = (\ @a x @b y -> (x :: a, y :: b) )+ :: forall a. a -> forall b. b -> (a, b)
@@ -14,3 +14,13 @@ @(HASH TPraosStandardCrypto) @ByteString "And the lamb lies down on Broadway"++test x = case x of+ Foo @t -> show @t 0+ Bar+ @t+ @u+ v ->+ ""++foo = foo @[k|bar|]
@@ -11,3 +11,11 @@ @(HASH TPraosStandardCrypto) @ByteString "And the lamb lies down on Broadway"++test x = case x of+ Foo @t -> show @t 0+ Bar+ @t @u v+ -> ""++foo = foo @[k|bar|]
@@ -1,10 +1,26 @@ {-# LANGUAGE UnboxedSums #-} +foo :: (# Int | Bool #) foo = (# 1 | #) +bar :: (# Int | Int | Int | Int #) bar = (# | | 2 | #) +baz ::+ (#+ Int |+ Int |+ Int |+ Int |+ Int |+ Int |+ Int |+ Int |+ Int+ #) baz = (# | | | 10 | | | | | #)++type UbxPair = (# | #)
@@ -1,7 +1,16 @@ {-# LANGUAGE UnboxedSums #-} +foo :: (# Int|Bool #) foo = (# 1 | #)++bar :: (#Int|Int|Int|Int #) bar = (# | |2| #)++baz :: (# Int |+ Int | Int | Int | Int | Int | Int |+ Int | Int #) baz = (# | | | 10 | | | | | #)++type UbxPair = (# | #)
@@ -8,3 +8,6 @@ 2, 3 #)++unit :: (# #)+unit = (# #)
@@ -5,3 +5,6 @@ 1, 2, 3 #)++unit :: (##)+unit = (##)
@@ -2,8 +2,7 @@ pattern P a <- C a where P a = C a -pattern HeadC x <-- x : xs+pattern HeadC x <- x : xs where HeadC x = [x] @@ -12,8 +11,7 @@ where HeadC' x = [x] -pattern Simple <-- "Simple"+pattern Simple <- "Simple" where Simple = "Complicated"
@@ -7,3 +7,12 @@ #-} test :: IO () test = pure ()++instance+ {-# WARNING "Don't use" #-}+ Show G1 where+ show = "G1"++deriving instance+ {-# WARNING "to be removed" #-}+ Eq G2
@@ -2,3 +2,11 @@ foo ["These are bad functions", "Really bad!"] #-} test :: IO () test = pure ()++instance+ {-# WARNING "Don't use" #-}+ Show G1 where+ show = "G1"++deriving instance+ {-# WARNING "to be removed" #-} Eq G2
@@ -6,8 +6,19 @@ bar = 3 {-# DEPRECATED bar "Bar is deprecated" #-} -{-# DEPRECATED baz "Baz is also deprecated" #-}+{-# DEPRECATED data baz "Baz is also deprecated" #-} baz = 5 data Number = Number Dobule-{-# DEPRECATED Number "Use Scientific instead." #-}+{-# DEPRECATED type Number "Use Scientific instead." #-}++head (a : _) = a+{-# WARNING in "x-partial" head "This function is partial..." #-}++instance {-# DEPRECATED "Don't use" #-} Show T1++instance {-# WARNING "Don't use either" #-} Show G1++deriving instance {-# DEPRECATED "to be removed" #-} Eq T2++deriving instance {-# WARNING "to be removed as well" #-} Eq G2
@@ -8,8 +8,17 @@ {-# Deprecated bar "Bar is deprecated" #-} -{-# DEPRECATED baz "Baz is also deprecated" #-}+{-# DEPRECATED data baz "Baz is also deprecated" #-} baz = 5 data Number = Number Dobule-{-# DEPRECATED Number "Use Scientific instead." #-}+{-# DEPRECATED type Number "Use Scientific instead." #-}++head (a:_) = a+{-# WARNING in "x-partial" head "This function is partial..." #-}++instance {-# DEPRECATED "Don't use" #-} Show T1 where+instance {-# WARNING "Don't use either" #-} Show G1 where++deriving instance {-# DEPRECATED "to be removed" #-} Eq T2+deriving instance {-# WARNING "to be removed as well" #-} Eq G2
@@ -0,0 +1,3 @@+module Bar (data P, T (data P), data f) where++import N (T (data P), data P, data f)
@@ -0,0 +1,6 @@++module Bar (data P, T(data P), data f) where++import N (data P)+import N (T(data P))+import N (data f)
@@ -0,0 +1,7 @@+module X+ ( {-# DEPRECATE D(D1) "D1 will not be exposed in a version 0.2 and later" #-}+ D (D1, D2),+ )+where++data D = D1 | D2
@@ -0,0 +1,5 @@+module X+ ( {-# DEPRECATE D(D1) "D1 will not be exposed in a version 0.2 and later" #-}+ D(D1, D2)+ ) where+data D = D1 | D2
@@ -0,0 +1,3 @@+module A ({-# DEPRECATED "blah" #-} x) where++x = True
@@ -0,0 +1,1 @@+module A ( {-# DEPRECATED "blah" #-} x ) where { x = True }
@@ -0,0 +1,12 @@+module Test+ ( since1, -- ^ @since 1.0+ since2, -- ^ @since 2.0+ since3, -- ^ @since 3.0+ SinceType (..), -- ^ @since 4.0+ SinceClass (..), -- ^ @since 5.0+ Multi (..),+ -- ^ since 6.0+ -- multi+ -- line+ )+where
@@ -0,0 +1,11 @@+module Test (+ since1, -- ^ @since 1.0+ since2 -- ^ @since 2.0+ , since3 -- ^ @since 3.0+ , SinceType(..) -- ^ @since 4.0+ , SinceClass(..) -- ^ @since 5.0+ , Multi(..)+ -- ^ since 6.0+ -- multi+ -- line+ ) where
@@ -0,0 +1,13 @@+{-# LANGUAGE ExplicitLevelImports #-}++import A splice+import {-# SOURCE #-} safe qualified A splice as QA hiding (a, b, c, d, e, f)+import quote qualified B as QB+import qualified C splice as SC+import qualified D splice+import Data.ByteString (e)+import Data.ByteString.Lazy quote (d)+import splice Data.Text (a, b, c)+import PyF ()+import splice PyF (fmt, tmf)+import quote PyF (abc)
@@ -0,0 +1,5 @@+{-# LANGUAGE ExplicitLevelImports #-}+{-# LANGUAGE ImportQualifiedPost #-}++import quote A qualified as QA+import B quote qualified as QB
@@ -0,0 +1,5 @@+{-# LANGUAGE ExplicitLevelImports #-}+{-# LANGUAGE ImportQualifiedPost #-}++import qualified B quote as QB+import quote qualified A as QA
@@ -0,0 +1,14 @@+{-# LANGUAGE ExplicitLevelImports #-}++import splice Data.Text (a, b, c)+import Data.ByteString.Lazy quote (d)+import Data.ByteString (e)+import {-# SOURCE #-} safe qualified A splice as QA hiding (a, b, c, d, e, f)+import quote qualified B as QB+import qualified C splice as SC+import A splice+import qualified D splice+import quote PyF (abc)+import splice PyF (fmt)+import splice PyF (tmf)+import PyF ()
@@ -0,0 +1,9 @@+{-# LANGUAGE PackageImports #-}++import D+import "a" Ab+import "b" Aa+import "b" Bb+import "c" Ba+import "zzzz" Z+import "this" Y
@@ -0,0 +1,10 @@+{-# LANGUAGE PackageImports #-}++import "b" Aa+import "a" Ab+import "c" Ba+import D+import "b" Bb++import "this" Y+import "zzzz" Z
@@ -0,0 +1,1 @@+module Test where
@@ -0,0 +1,3 @@+-- |+--+module Test where
@@ -0,0 +1,4 @@+module Foo+ ( -- test+ )+where
@@ -0,0 +1,2 @@+module Foo ( -- test+ ) where
@@ -5,12 +5,12 @@ foo _ = True foo ::- Foo a =>+ (Foo a) => -- | Foo Int -> Int foo ::- Foo a =>+ (Foo a) => -- | Foo Int -> Int
@@ -0,0 +1,6 @@+foo =+ let+ in 10++-- a comment+bar = 20
@@ -0,0 +1,6 @@+foo =+ let+ in 10++-- a comment+bar = 20
@@ -0,0 +1,7 @@+-- | Something.+foo ::+ -- | Foo.+ Int ->+ -- | Bar.+ IO ()+foo _ = pure () -- comment
@@ -0,0 +1,7 @@+-- |Something.+foo ::+ -- |Foo.+ Int ->+ -- |Bar.+ IO ()+foo _ = pure () --comment
@@ -1,3 +1,5 @@+{-# LANGUAGE CPP #-}+ foo :: Int foo = 5
@@ -1,3 +1,5 @@+{-# LANGUAGE CPP #-}+ foo :: Int foo = 5
@@ -0,0 +1,8 @@+{-# LANGUAGE CPP #-}++module Bug where++#ifdef flag+constant :: Int+constant = 1312+#endif
@@ -0,0 +1,8 @@+{-# LANGUAGE CPP #-}++module Bug where++#ifdef flag+constant :: Int+constant = 1312+#endif
@@ -1,3 +1,5 @@+{-# LANGUAGE CPP #-}+ module Main (main) where import Data.Void
@@ -1,3 +1,5 @@+{-# LANGUAGE CPP #-}+ module Main (main) where import Data.Void
@@ -1,7 +1,8 @@-instance Stream s => Monad (ParsecT e s m) where+{-# LANGUAGE CPP #-}++instance (Stream s) => Monad (ParsecT e s m) where return = pure (>>=) = pBind- #if !(MIN_VERSION_base(4,13,0)) fail = Fail.fail #endif
@@ -1,3 +1,5 @@+{-# LANGUAGE CPP #-}+ instance Stream s => Monad (ParsecT e s m) where return = pure (>>=) = pBind
@@ -1,7 +1,8 @@-instance Stream s => Monad (ParsecT e s m) where+{-# LANGUAGE CPP #-}++instance (Stream s) => Monad (ParsecT e s m) where return = pure (>>=) = pBind- #if !(MIN_VERSION_base(4,13,0)) fail = Fail.fail #endif
@@ -1,3 +1,5 @@+{-# LANGUAGE CPP #-}+ instance Stream s => Monad (ParsecT e s m) where return = pure (>>=) = pBind
@@ -1,10 +1,11 @@+{-# LANGUAGE CPP #-}+ decompressingPipe :: (PrimMonad m, MonadThrow m, MonadResource m) => CompressionMethod -> ConduitT ByteString ByteString m () decompressingPipe Store = C.awaitForever C.yield decompressingPipe Deflate = Z.decompress $ Z.WindowBits (-15)- #ifdef ENABLE_BZIP2 decompressingPipe BZip2 = BZ.bunzip2 #else
@@ -1,3 +1,5 @@+{-# LANGUAGE CPP #-}+ decompressingPipe :: (PrimMonad m, MonadThrow m, MonadResource m) => CompressionMethod
@@ -1,10 +1,11 @@+{-# LANGUAGE CPP #-}+ decompressingPipe :: (PrimMonad m, MonadThrow m, MonadResource m) => CompressionMethod -> ConduitT ByteString ByteString m () decompressingPipe Store = C.awaitForever C.yield decompressingPipe Deflate = Z.decompress $ Z.WindowBits (-15)- #ifdef ENABLE_BZIP2 decompressingPipe BZip2 = BZ.bunzip2 #else
@@ -1,3 +1,5 @@+{-# LANGUAGE CPP #-}+ decompressingPipe :: (PrimMonad m, MonadThrow m, MonadResource m) => CompressionMethod
@@ -1,5 +1,6 @@-ffff, ffffffff :: Natural+{-# LANGUAGE CPP #-} +ffff, ffffffff :: Natural #ifdef HASKELL_ZIP_DEV_MODE ffff = 200 ffffffff = 5000
@@ -1,3 +1,5 @@+{-# LANGUAGE CPP #-}+ ffff, ffffffff :: Natural #ifdef HASKELL_ZIP_DEV_MODE ffff = 200
@@ -1,3 +1,5 @@+{-# LANGUAGE CPP #-}+ ffff, ffffffff :: Natural #ifdef HASKELL_ZIP_DEV_MODE ffff = 200
@@ -1,3 +1,5 @@+{-# LANGUAGE CPP #-}+ ffff, ffffffff :: Natural #ifdef HASKELL_ZIP_DEV_MODE ffff = 200
@@ -1,3 +1,5 @@+{-# LANGUAGE CPP #-}+ sinkData h compression = do (uncompressedSize, crc32, compressedSize) <- case compression of
@@ -1,3 +1,5 @@+{-# LANGUAGE CPP #-}+ sinkData h compression = do (uncompressedSize, crc32, compressedSize) <- case compression of
@@ -1,3 +1,5 @@+{-# LANGUAGE CPP #-}+ module Main (main) where import Data.Void
@@ -1,3 +1,5 @@+{-# LANGUAGE CPP #-}+ module Main (main) where import Data.Void
@@ -0,0 +1,3 @@+{- ORMOLU_DISABLE -}+a::String+a="-}"
@@ -0,0 +1,3 @@+{- ORMOLU_DISABLE -}+a::String+a="-}"
@@ -0,0 +1,7 @@+{- ORMOLU_DISABLE -}+{- ORMOLU_ENABLE -}+foo = 0+{- ORMOLU_DISABLE -}+{- ORMOLU_ENABLE -}+bar = 1+{- ORMOLU_DISABLE -}
@@ -0,0 +1,7 @@+{- ORMOLU_DISABLE -}+{- ORMOLU_ENABLE -}+foo = 0+{- ORMOLU_DISABLE -}+{- ORMOLU_ENABLE -}+bar = 1+{- ORMOLU_DISABLE -}
@@ -1,7 +0,0 @@-foo =- {- ORMOLU_DISABLE -}- testCase "Foo" testFoo :- testCase "Bar" testBar :- testCase "Baz" testBaz :- {- ORMOLU_ENABLE -}- []
@@ -1,7 +0,0 @@-foo =- {- ORMOLU_DISABLE -}- testCase "Foo" testFoo :- testCase "Bar" testBar :- testCase "Baz" testBaz :- {- ORMOLU_ENABLE -}- []
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff
file too large to diff