Skip to content

Version 0.7.1 #88

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions .github/workflows/cabal-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ jobs:

# Restore dist-newstyle
- name: Cache dist-newstyle
id: dist-cache-restore
uses: actions/cache@v4
with:
path: |
dist-newstyle
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
Expand All @@ -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
Expand All @@ -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 }}

6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
13 changes: 7 additions & 6 deletions configuration-tools.cabal
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -30,19 +30,20 @@ bug-reports: https://github.com/alephcloud/hs-configuration-tools/issues
license: MIT
license-file: LICENSE
author: Lars Kuhtz <[email protected]>
maintainer: Lars Kuhtz <[email protected]>
maintainer: Lars Kuhtz <[email protected]>, Edmund Noble <[email protected]>
copyright:
(c) 2024-2025 Edmund Noble <[email protected]>,
(c) 2019-2020 Colin Woodbury <[email protected]>,
(c) 2015-2023 Lars Kuhtz <[email protected]>,
(c) 2015-2025 Lars Kuhtz <[email protected]>,
(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,
Expand Down
21 changes: 17 additions & 4 deletions src/Configuration/Utils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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]
Expand Down