diff --git a/.github/workflows/cabal-ci.yaml b/.github/workflows/cabal-ci.yaml index 99825d4..22268ba 100644 --- a/.github/workflows/cabal-ci.yaml +++ b/.github/workflows/cabal-ci.yaml @@ -57,6 +57,7 @@ jobs: # Restore dist-newstyle - name: Cache dist-newstyle + id: dist-cache-restore uses: actions/cache@v4 with: path: | @@ -64,7 +65,6 @@ jobs: key: dist-${{ matrix.os }}-${{ matrix.ghc }}-${{ hashFiles('**/*.cabal', '**/cabal.project', '**/cabal.project.local') }} restore-keys: | dist-${{ matrix.os }}-${{ matrix.ghc }}- - save-always: true # Build - name: Update package database @@ -85,7 +85,7 @@ jobs: # Save packages - name: Save cache for ~/.cabal/packages and ~/.cabal/store uses: actions/cache/save@v4 - if: always() + if: always() && steps.deps-cache-restore.outputs.cache-hit != 'true' with: path: | ~/.cabal/packages @@ -99,3 +99,12 @@ jobs: - name: Run Tests run: cabal test + # Safe dist + - name: Save cache dist-newstyle + uses: actions/cache/save@v4 + if: always() && steps.dist-cache-restore.outputs.cache-hit != 'true' + with: + path: | + dist-newstyle + key: ${{ steps.dist-cache-restore.outputs.cache-primary-key }} + diff --git a/CHANGELOG.md b/CHANGELOG.md index 513cf91..6c33ada 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # configuration-tools +## 0.7.1 (2025-03-04) + +* Support lastest GHC (9.12) +* Use setters instead of lenses in ..: and %.: +* Allow validation functions to return new values + ## 0.7.0 (2022-06-22) The version bump is due to the update of the dependency on optparse-applicative, diff --git a/configuration-tools.cabal b/configuration-tools.cabal index 78c7e02..b1fdc5a 100644 --- a/configuration-tools.cabal +++ b/configuration-tools.cabal @@ -1,7 +1,7 @@ cabal-version: 3.0 name: configuration-tools -version: 0.7.0 +version: 0.7.1 synopsis: Tools for specifying and parsing configurations description: Tools for specifying and parsing configurations @@ -30,19 +30,20 @@ bug-reports: https://github.com/alephcloud/hs-configuration-tools/issues license: MIT license-file: LICENSE author: Lars Kuhtz -maintainer: Lars Kuhtz +maintainer: Lars Kuhtz , Edmund Noble copyright: + (c) 2024-2025 Edmund Noble , (c) 2019-2020 Colin Woodbury , - (c) 2015-2023 Lars Kuhtz , + (c) 2015-2025 Lars Kuhtz , (c) 2014-2015 AlephCloud, Inc. category: Configuration, Console build-type: Custom tested-with: + , GHC==9.12 + , GHC==9.10 + , GHC==9.8 , GHC==9.6 , GHC==9.4 - , GHC==9.2 - , GHC==9.0.1 - , GHC==8.10.7 extra-doc-files: README.md, diff --git a/src/Configuration/Utils.hs b/src/Configuration/Utils.hs index b177f18..dd97d6e 100644 --- a/src/Configuration/Utils.hs +++ b/src/Configuration/Utils.hs @@ -280,19 +280,19 @@ programInfo -- ^ default configuration → ProgramInfo a programInfo desc parser defaultConfig = - programInfoValidate desc parser defaultConfig $ return + programInfoValidate desc parser defaultConfig $ const (return ()) -- | Smart constructor for 'ProgramInfo'. -- -- 'piHelpHeader' and 'piHelpFooter' are set to 'Nothing'. -- -programInfoValidate +programInfoValidate' ∷ String → MParser a → a → ConfigValidation' a f r → ProgramInfoValidate' a f r -programInfoValidate desc parser defaultConfig valFunc = ProgramInfo +programInfoValidate' desc parser defaultConfig valFunc = ProgramInfo { _piDescription = desc , _piHelpHeader = Nothing , _piHelpFooter = Nothing @@ -302,6 +302,19 @@ programInfoValidate desc parser defaultConfig valFunc = ProgramInfo , _piConfigurationFiles = [] } +-- | Smart constructor for 'ProgramInfo'. +-- +-- 'piHelpHeader' and 'piHelpFooter' are set to 'Nothing'. +-- +programInfoValidate + ∷ String + → MParser a + → a + → ConfigValidation a f + → ProgramInfoValidate a f +programInfoValidate desc parser defaultConfig valFunc = + programInfoValidate' desc parser defaultConfig $ \c -> valFunc c >> return c + -- -------------------------------------------------------------------------- -- -- AppConfiguration @@ -718,7 +731,7 @@ parseConfiguration ) ⇒ T.Text -- ^ program name (used in error messages) - → ProgramInfoValidate a f + → ProgramInfoValidate' a f r -- ^ program info value; use 'programInfo' to construct a value of this -- type → [String]