Put end on separate line when pretty printing definitions (#2100)
Some checks are pending
Enforce issue references for TODOs / Enforce issue references (push) Waiting to run
Haskell-CI-Windows / Haskell-CI - ${{ matrix.os }} - ghc-${{ matrix.ghc }} (3.10.1.0, 9.8.2, windows-latest) (push) Waiting to run
Haskell-CI / Haskell-CI - Linux - ${{ matrix.compiler }} (false, ghc-9.2.8, ghc, 9.2.8, ghcup) (push) Waiting to run
Haskell-CI / Haskell-CI - Linux - ${{ matrix.compiler }} (false, ghc-9.4.8, ghc, 9.4.8, ghcup) (push) Waiting to run
Haskell-CI / Haskell-CI - Linux - ${{ matrix.compiler }} (false, ghc-9.6.5, ghc, 9.6.5, ghcup) (push) Waiting to run
Haskell-CI / Haskell-CI - Linux - ${{ matrix.compiler }} (false, ghc-9.8.2, ghc, 9.8.2, ghcup) (push) Waiting to run
HLint / HLint (push) Waiting to run
Normalize cabal file formatting / Normalize cabal (push) Waiting to run

```diff
 def intersperse
   = \n. \f2. \f1.
-  if (n > 0) {f1; if (n > 1) {f2} {}; intersperse (n - 1) f2 f1} {} end
+  if (n > 0) {f1; if (n > 1) {f2} {}; intersperse (n - 1) f2 f1} {}
+ end
```

You can test it with:
```sh
swarm format -i data/scenarios/Challenges/_arbitrage/solution.sw
```

* caused by #1928 where def was made more similar to let
This commit is contained in:
Ondřej Šebek 2024-08-09 17:23:54 +02:00 committed by GitHub
parent f82a544cc5
commit 6d1027cc56
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -316,7 +316,7 @@ instance PrettyPrec (Term' ty) where
]
SLet LSDef _ (LV _ x) mty _ t1 t2 ->
mconcat $
prettyDefinition "def" x mty t1 <+> "end"
sep [prettyDefinition "def" x mty t1, "end"]
: case t2 of
Syntax' _ (TConst Noop) _ _ -> []
_ -> [hardline, hardline, ppr t2]