Skip to content

Commit

Permalink
Let HIndent format multiple files in parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
toku-sa-n committed Jun 11, 2024
1 parent 9a9d953 commit 69dab15
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- Support for GHC 9.8 ([#775]).
- Support for `ImportPostQualified` ([#875]).
- HIndent now formats multiple files in parallel ([#914]).

### Changed

Expand Down Expand Up @@ -377,6 +378,7 @@ This version is accidentally pushlished, and is the same as 5.3.3.
[@uhbif19]: https://github.com/uhbif19
[@toku-sa-n]: https://github.com/toku-sa-n

[#914]: https://github.com/mihaimaruseac/hindent/pull/914
[#875]: https://github.com/mihaimaruseac/hindent/pull/875
[#873]: https://github.com/mihaimaruseac/hindent/pull/873
[#868]: https://github.com/mihaimaruseac/hindent/pull/868
Expand Down
15 changes: 10 additions & 5 deletions hindent.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,10 @@ library
Paths_hindent
hs-source-dirs:
src
ghc-options: -Wall -O2
ghc-options: -Wall -O2 -threaded
build-depends:
Cabal
, async
, base >=4.7 && <5
, bytestring
, containers
Expand Down Expand Up @@ -183,9 +184,10 @@ library hindent-internal
Paths_hindent
hs-source-dirs:
internal
ghc-options: -Wall -O2
ghc-options: -Wall -O2 -threaded
build-depends:
Cabal
, async
, base >=4.7 && <5
, bytestring
, containers
Expand Down Expand Up @@ -217,9 +219,10 @@ executable hindent
Paths_hindent
hs-source-dirs:
app
ghc-options: -Wall -O2
ghc-options: -Wall -O2 -threaded
build-depends:
Cabal
, async
, base >=4.7 && <5
, bytestring
, containers
Expand Down Expand Up @@ -252,10 +255,11 @@ test-suite hindent-test
Paths_hindent
hs-source-dirs:
tests
ghc-options: -Wall -O2
ghc-options: -Wall -O2 -threaded
build-depends:
Cabal
, Diff
, async
, base >=4.7 && <5
, bytestring
, containers
Expand Down Expand Up @@ -290,9 +294,10 @@ benchmark hindent-bench
Paths_hindent
hs-source-dirs:
benchmarks
ghc-options: -Wall -O2
ghc-options: -Wall -O2 -threaded
build-depends:
Cabal
, async
, base >=4.7 && <5
, bytestring
, containers
Expand Down
3 changes: 2 additions & 1 deletion package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ extra-source-files:
data-files: elisp/hindent.el
github: mihaimaruseac/hindent

ghc-options: -Wall -O2
ghc-options: -Wall -O2 -threaded

dependencies:
- Cabal
- async
- base >= 4.7 && < 5
- bytestring
- containers
Expand Down
3 changes: 2 additions & 1 deletion src/HIndent.hs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ module HIndent
, HsModule'
) where

import Control.Concurrent.Async
import Control.Exception
import Control.Monad
import Data.ByteString (ByteString)
Expand Down Expand Up @@ -79,7 +80,7 @@ hindent args = do
then S8.interact
(either (error . prettyParseError) id
. reformat style exts Nothing)
else forM_ paths $ \filepath -> do
else forConcurrently_ paths $ \filepath -> do
cabalexts <- getCabalExtensionsForSourcePath filepath
text <- S.readFile filepath
case reformat style (cabalexts ++ exts) (Just filepath) text of
Expand Down

0 comments on commit 69dab15

Please sign in to comment.