From 6d14bab521a4d1bf0ae7b4693b2bb273888b7bdd Mon Sep 17 00:00:00 2001 From: Hiroki Tokunaga Date: Mon, 1 May 2023 19:13:01 +0900 Subject: [PATCH 1/2] Remove the `text` dependency --- hindent.cabal | 5 - package.yaml | 153 +++++++++++++++--------------- src/HIndent/CommandlineOptions.hs | 4 +- src/HIndent/LanguageExtension.hs | 5 +- 4 files changed, 79 insertions(+), 88 deletions(-) diff --git a/hindent.cabal b/hindent.cabal index 86df2ff02..ca79ec974 100644 --- a/hindent.cabal +++ b/hindent.cabal @@ -92,7 +92,6 @@ library , regex-tdfa , split , syb - , text , transformers , unicode-show , utf8-string @@ -137,7 +136,6 @@ library hindent-internal , regex-tdfa , split , syb - , text , transformers , unicode-show , utf8-string @@ -181,7 +179,6 @@ executable hindent , regex-tdfa , split , syb - , text , transformers , unicode-show , utf8-string @@ -229,7 +226,6 @@ test-suite hindent-test , regex-tdfa , split , syb - , text , transformers , unicode-show , utf8-string @@ -277,7 +273,6 @@ benchmark hindent-bench , regex-tdfa , split , syb - , text , transformers , unicode-show , utf8-string diff --git a/package.yaml b/package.yaml index 1783fada1..0fabc7a1f 100644 --- a/package.yaml +++ b/package.yaml @@ -1,97 +1,96 @@ spec-version: 0.30.0 -name: hindent -version: 6.0.1 -synopsis: Extensible Haskell pretty printer -description: "Extensible Haskell pretty printer. Both a library and an executable. See the GitHub page for usage / explanation: " -category: Development -stability: Unstable -homepage: https://github.com/mihaimaruseac/hindent -bug-reports: https://github.com/mihaimaruseac/hindent/issues -author: Mihai Maruseac, Chris Done, Andrew Gibiansky, Tobias Pflug, Pierre Radermecker -maintainer: Mihai Maruseac -copyright: 2014 Chris Done, 2015 Andrew Gibiansky, 2021 Mihai Maruseac -license: BSD3 +name: hindent +version: 6.0.1 +synopsis: Extensible Haskell pretty printer +description: "Extensible Haskell pretty printer. Both a library and an executable. See the GitHub page for usage / explanation: " +category: Development +stability: Unstable +homepage: https://github.com/mihaimaruseac/hindent +bug-reports: https://github.com/mihaimaruseac/hindent/issues +author: Mihai Maruseac, Chris Done, Andrew Gibiansky, Tobias Pflug, Pierre Radermecker +maintainer: Mihai Maruseac +copyright: 2014 Chris Done, 2015 Andrew Gibiansky, 2021 Mihai Maruseac +license: BSD3 license-file: LICENSE.md -build-type: Simple +build-type: Simple extra-source-files: - - README.md - - CHANGELOG.md - - BENCHMARKS.md - - TESTS.md -data-files: elisp/hindent.el -github: mihaimaruseac/hindent + - README.md + - CHANGELOG.md + - BENCHMARKS.md + - TESTS.md +data-files: elisp/hindent.el +github: mihaimaruseac/hindent ghc-options: -Wall -O2 dependencies: - - Cabal - - base >= 4.7 && < 5 - - bytestring - - containers - - directory - - exceptions - - filepath - - ghc-lib-parser-ex - - monad-loops - - mtl - - optparse-applicative - - path - - path-io - - regex-tdfa - - split - - syb - - text - - transformers - - unicode-show - - utf8-string - - yaml + - Cabal + - base >= 4.7 && < 5 + - bytestring + - containers + - directory + - exceptions + - filepath + - ghc-lib-parser-ex + - monad-loops + - mtl + - optparse-applicative + - path + - path-io + - regex-tdfa + - split + - syb + - transformers + - unicode-show + - utf8-string + - yaml when: - - condition: impl(ghc >= 9.6.1) - then: - dependencies: ghc-lib-parser >= 9.6.1.20230312 && < 9.7 - else: - when: - - condition: impl(ghc >= 9.4.1) - then: - dependencies: ghc-lib-parser >= 9.4.1.20220807 && < 9.5 - else: - dependencies: ghc-lib-parser >= 9.2.3.20220527 && < 9.3 + - condition: impl(ghc >= 9.6.1) + then: + dependencies: ghc-lib-parser >= 9.6.1.20230312 && < 9.7 + else: + when: + - condition: impl(ghc >= 9.4.1) + then: + dependencies: ghc-lib-parser >= 9.4.1.20220807 && < 9.5 + else: + dependencies: ghc-lib-parser >= 9.2.3.20220527 && < 9.3 library: - source-dirs: src + source-dirs: src internal-libraries: - hindent-internal: - source-dirs: internal - dependencies: - - deepseq + hindent-internal: + source-dirs: internal + dependencies: + - deepseq executable: - main: Main.hs - source-dirs: app - dependencies: - - hindent - generated-other-modules: - - Paths_hindent - -tests: - hindent-test: main: Main.hs - source-dirs: tests + source-dirs: app dependencies: - - Diff - - hindent - - hindent-internal - - hspec + - hindent + generated-other-modules: + - Paths_hindent + +tests: + hindent-test: + main: Main.hs + source-dirs: tests + dependencies: + - Diff + - hindent + - hindent-internal + - hspec benchmarks: - hindent-bench: - main: Main.hs - source-dirs: benchmarks - dependencies: - - criterion - - deepseq - - hindent - - hindent-internal + hindent-bench: + main: Main.hs + source-dirs: benchmarks + dependencies: + - criterion + - deepseq + - hindent + - hindent-internal diff --git a/src/HIndent/CommandlineOptions.hs b/src/HIndent/CommandlineOptions.hs index 66fbcc428..9fbc96988 100644 --- a/src/HIndent/CommandlineOptions.hs +++ b/src/HIndent/CommandlineOptions.hs @@ -6,7 +6,6 @@ module HIndent.CommandlineOptions ) where import Data.Maybe -import qualified Data.Text as T import HIndent.Config import HIndent.LanguageExtension import HIndent.LanguageExtension.Types @@ -40,8 +39,7 @@ options config = fmap getExtensions (many - (T.pack <$> - strOption + (strOption (short 'X' <> help "Language extension" <> metavar "GHCEXT"))) indentSpaces = option diff --git a/src/HIndent/LanguageExtension.hs b/src/HIndent/LanguageExtension.hs index 6b8f7afae..c7eb1c08a 100644 --- a/src/HIndent/LanguageExtension.hs +++ b/src/HIndent/LanguageExtension.hs @@ -15,7 +15,6 @@ import Data.Char import Data.List import Data.List.Split import Data.Maybe -import qualified Data.Text as T import qualified GHC.Driver.Session as GLP import qualified GHC.LanguageExtensions as GLP import HIndent.LanguageExtension.Conversion @@ -48,8 +47,8 @@ collectLanguageExtensionsFromSource = collectLanguageExtensionsFromSourceViaOptionsPragma -- | Consume an extensions list from arguments. -getExtensions :: [T.Text] -> [Extension] -getExtensions = foldr (f . T.unpack) defaultExtensions +getExtensions :: [String] -> [Extension] +getExtensions = foldr f defaultExtensions where f "Haskell98" _ = [] f x a = From 0ca0078f18f3ce7254eaae1a136387d186059785 Mon Sep 17 00:00:00 2001 From: Hiroki Tokunaga Date: Mon, 1 May 2023 19:13:58 +0900 Subject: [PATCH 2/2] Fix formatting --- package.yaml | 152 +++++++++++++++++++++++++-------------------------- 1 file changed, 76 insertions(+), 76 deletions(-) diff --git a/package.yaml b/package.yaml index 0fabc7a1f..5cfd4c4e5 100644 --- a/package.yaml +++ b/package.yaml @@ -1,96 +1,96 @@ spec-version: 0.30.0 -name: hindent -version: 6.0.1 -synopsis: Extensible Haskell pretty printer -description: "Extensible Haskell pretty printer. Both a library and an executable. See the GitHub page for usage / explanation: " -category: Development -stability: Unstable -homepage: https://github.com/mihaimaruseac/hindent -bug-reports: https://github.com/mihaimaruseac/hindent/issues -author: Mihai Maruseac, Chris Done, Andrew Gibiansky, Tobias Pflug, Pierre Radermecker -maintainer: Mihai Maruseac -copyright: 2014 Chris Done, 2015 Andrew Gibiansky, 2021 Mihai Maruseac -license: BSD3 +name: hindent +version: 6.0.1 +synopsis: Extensible Haskell pretty printer +description: "Extensible Haskell pretty printer. Both a library and an executable. See the GitHub page for usage / explanation: " +category: Development +stability: Unstable +homepage: https://github.com/mihaimaruseac/hindent +bug-reports: https://github.com/mihaimaruseac/hindent/issues +author: Mihai Maruseac, Chris Done, Andrew Gibiansky, Tobias Pflug, Pierre Radermecker +maintainer: Mihai Maruseac +copyright: 2014 Chris Done, 2015 Andrew Gibiansky, 2021 Mihai Maruseac +license: BSD3 license-file: LICENSE.md -build-type: Simple +build-type: Simple extra-source-files: - - README.md - - CHANGELOG.md - - BENCHMARKS.md - - TESTS.md -data-files: elisp/hindent.el -github: mihaimaruseac/hindent + - README.md + - CHANGELOG.md + - BENCHMARKS.md + - TESTS.md +data-files: elisp/hindent.el +github: mihaimaruseac/hindent ghc-options: -Wall -O2 dependencies: - - Cabal - - base >= 4.7 && < 5 - - bytestring - - containers - - directory - - exceptions - - filepath - - ghc-lib-parser-ex - - monad-loops - - mtl - - optparse-applicative - - path - - path-io - - regex-tdfa - - split - - syb - - transformers - - unicode-show - - utf8-string - - yaml + - Cabal + - base >= 4.7 && < 5 + - bytestring + - containers + - directory + - exceptions + - filepath + - ghc-lib-parser-ex + - monad-loops + - mtl + - optparse-applicative + - path + - path-io + - regex-tdfa + - split + - syb + - transformers + - unicode-show + - utf8-string + - yaml when: - - condition: impl(ghc >= 9.6.1) - then: - dependencies: ghc-lib-parser >= 9.6.1.20230312 && < 9.7 - else: - when: - - condition: impl(ghc >= 9.4.1) - then: - dependencies: ghc-lib-parser >= 9.4.1.20220807 && < 9.5 - else: - dependencies: ghc-lib-parser >= 9.2.3.20220527 && < 9.3 + - condition: impl(ghc >= 9.6.1) + then: + dependencies: ghc-lib-parser >= 9.6.1.20230312 && < 9.7 + else: + when: + - condition: impl(ghc >= 9.4.1) + then: + dependencies: ghc-lib-parser >= 9.4.1.20220807 && < 9.5 + else: + dependencies: ghc-lib-parser >= 9.2.3.20220527 && < 9.3 library: - source-dirs: src + source-dirs: src internal-libraries: - hindent-internal: - source-dirs: internal - dependencies: - - deepseq + hindent-internal: + source-dirs: internal + dependencies: + - deepseq executable: - main: Main.hs - source-dirs: app - dependencies: - - hindent - generated-other-modules: - - Paths_hindent + main: Main.hs + source-dirs: app + dependencies: + - hindent + generated-other-modules: + - Paths_hindent tests: - hindent-test: - main: Main.hs - source-dirs: tests - dependencies: - - Diff - - hindent - - hindent-internal - - hspec + hindent-test: + main: Main.hs + source-dirs: tests + dependencies: + - Diff + - hindent + - hindent-internal + - hspec benchmarks: - hindent-bench: - main: Main.hs - source-dirs: benchmarks - dependencies: - - criterion - - deepseq - - hindent - - hindent-internal + hindent-bench: + main: Main.hs + source-dirs: benchmarks + dependencies: + - criterion + - deepseq + - hindent + - hindent-internal