ormolu 0.1.2.0 → 0.1.3.0
raw patch · 11 files changed
+58/−28 lines, 11 filesdep ~pathPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: path
API changes (from Hackage documentation)
Files
- CHANGELOG.md +11/−0
- README.md +22/−13
- app/Main.hs +10/−6
- data/examples/declaration/type/promotion-out.hs +2/−0
- data/examples/declaration/type/promotion.hs +2/−1
- data/examples/declaration/value/pattern-synonyms/bidirectional.hs +0/−1
- data/examples/declaration/value/pattern-synonyms/explicitely-bidirectional-out.hs +2/−0
- data/examples/declaration/value/pattern-synonyms/explicitely-bidirectional.hs +2/−1
- ormolu.cabal +4/−4
- src/Ormolu/Printer/Meat/Declaration/Value.hs +2/−2
- src/Ormolu/Printer/Meat/Type.hs +1/−0
CHANGELOG.md view
@@ -1,3 +1,14 @@+## Ormolu 0.1.3.0++* Ormolu no longer overwrites already formatted files. [PR+ 649](https://github.com/tweag/ormolu/pull/649).++* Now a space is guaranteed before ticked promoted types. [Issue+ 631](https://github.com/tweag/ormolu/issues/631).++* Formatting of single-line explicitly bidirectional pattern synonyms+ idempotent. [Issue 630](https://github.com/tweag/ormolu/issues/630).+ ## Ormolu 0.1.2.0 * Fixed the bug when comments in different styles got glued together after
README.md view
@@ -22,7 +22,7 @@ * That formatting style aims to result in minimal diffs while still remaining very close to “conventional” Haskell formatting people use. * Choose a style compatible with modern dialects of Haskell. As new Haskell- extensions enter broad use, we may change the style to accomodate them.+ extensions enter broad use, we may change the style to accommodate them. * Idempotence: formatting already formatted code doesn't change it. * Be well-tested and robust to the point that it can be used in large projects without exposing unfortunate, disappointing bugs here and there.@@ -114,10 +114,10 @@ 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 the source code should-still be parseable even without the “excluded” part. Because of that the-magic comments cannot be placed arbitrary, but should rather enclose-independent top-level definitions.+`{- 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. ## Current limitations @@ -130,14 +130,6 @@ criterion than just being valid Haskell modules. * Various minor idempotence issues, most of them are related to comments. -## Editor integration--We know of the following editor integrations:--* [Emacs][emacs-package]-* [VS Code][vs-code-plugin]-* vim: [neoformat][neoformat], [vim-ormolu][vim-ormolu]- ## Running on Hackage It's possible to try Ormolu on arbitrary packages from Hackage. For that@@ -152,6 +144,22 @@ `.hs-original` extension (those are with CPP dropped, exactly what is fed into Ormolu). +## Editor integration++We know of the following editor integrations:++* [Emacs][emacs-package]+* [VS Code][vs-code-plugin]+* vim: [neoformat][neoformat], [vim-ormolu][vim-ormolu]++## Arch Linux++To install Ormolu on Arch Linux, one can use [the package on AUR][aur]:++```console+yay -S ormolu+```+ ## Contributing See [CONTRIBUTING.md][contributing].@@ -170,3 +178,4 @@ [vs-code-plugin]: https://marketplace.visualstudio.com/items?itemName=sjurmillidahl.ormolu-vscode [vim-ormolu]: https://github.com/sdiehl/vim-ormolu [neoformat]: https://github.com/sbdchd/neoformat+[aur]: https://aur.archlinux.org/packages/ormolu
app/Main.hs view
@@ -61,15 +61,19 @@ -- 101 is different from all the other exit codes we already use. exitWith (ExitFailure 101) Just inputFile -> do- r <- ormoluFile config inputFile+ originalInput <- TIO.readFile inputFile+ formattedInput <- ormoluFile config inputFile case mode of Stdout ->- TIO.putStr r- InPlace ->- TIO.writeFile inputFile r+ TIO.putStr formattedInput+ 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 Check -> do- r' <- TIO.readFile inputFile- when (r /= r') $+ when (formattedInput /= originalInput) $ -- 100 is different to all the other exit code that are emitted -- either from an 'OrmoluException' or from 'error' and -- 'notImplemented'.
data/examples/declaration/type/promotion-out.hs view
@@ -1,5 +1,7 @@ type Foo = Cluster '[ 'NodeCore, 'NodeRelay', 'NodeEdge] +type Query = Query '[] '[] DB '[ 'NotNull 'PGint4] (RowPG RawElementData)+ data T = T' | T'T type S0 = ' T'
data/examples/declaration/type/promotion.hs view
@@ -1,5 +1,7 @@ type Foo = Cluster '[ 'NodeCore, 'NodeRelay', 'NodeEdge ] +type Query = Query '[] '[] DB '[ 'NotNull 'PGint4] (RowPG RawElementData)+ data T = T' | T'T type S0 = ' T'@@ -12,4 +14,3 @@ type S6 = Proxy ( '( '(), '() )) type S7 = Proxy ( '( 'a, 'b )) type S8 = Proxy ( '[ Int, Bool ])-
data/examples/declaration/value/pattern-synonyms/bidirectional.hs view
@@ -18,4 +18,3 @@ pattern a :< b <- (a , b)-
data/examples/declaration/value/pattern-synonyms/explicitely-bidirectional-out.hs view
@@ -1,5 +1,7 @@ {-# LANGUAGE PatternSynonyms #-} +pattern P a <- C a where P a = C a+ pattern HeadC x <- x : xs where
data/examples/declaration/value/pattern-synonyms/explicitely-bidirectional.hs view
@@ -1,5 +1,7 @@ {-# LANGUAGE PatternSynonyms #-} +pattern P a <- C a where P a = C a+ pattern HeadC x <- x:xs where HeadC x = [x] @@ -16,4 +18,3 @@ (a , b) where a :< b = (a, b)-
ormolu.cabal view
@@ -1,10 +1,10 @@ cabal-version: 1.18 name: ormolu-version: 0.1.2.0+version: 0.1.3.0 license: BSD3 license-file: LICENSE.md maintainer: Mark Karpov <mark.karpov@tweag.io>-tested-with: ghc ==8.6.5 ghc ==8.8.3 ghc ==8.10.1+tested-with: ghc ==8.6.5 ghc ==8.8.4 ghc ==8.10.1 homepage: https://github.com/tweag/ormolu bug-reports: https://github.com/tweag/ormolu/issues synopsis: A formatter for Haskell source code@@ -119,7 +119,7 @@ base >=4.12 && <5.0, bytestring >=0.2 && <0.11, containers >=0.5 && <0.7,- dlist >=0.8 && <0.9,+ dlist >=0.8 && <2.0, exceptions >=0.6 && <0.11, ghc-lib-parser >=8.10 && <8.11, mtl >=2.0 && <3.0,@@ -144,7 +144,7 @@ base >=4.12 && <5.0, ghc-lib-parser >=8.10 && <8.11, gitrev >=1.3 && <1.4,- optparse-applicative >=0.14 && <0.16,+ optparse-applicative >=0.14 && <0.17, ormolu -any, text >=0.2 && <1.3
src/Ormolu/Printer/Meat/Declaration/Value.hs view
@@ -832,9 +832,9 @@ txt "<-" breakpoint located psb_def p_pat- newline+ breakpoint txt "where"- newline+ breakpoint inci (p_matchGroup (Function psb_id) mgroup) txt "pattern" case psb_args of
src/Ormolu/Printer/Meat/Type.hs view
@@ -52,6 +52,7 @@ HsTyVar NoExtField p n -> do case p of IsPromoted -> do+ space txt "'" case showOutputable (unLoc n) of _ : '\'' : _ -> space