packages feed

opt-env-conf 0.12.1.0 → 0.12.2.0

raw patch · 4 files changed

+23/−8 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ OptEnvConf.Check: CheckFailed :: NonEmpty ParseError -> CheckResult a
+ OptEnvConf.Check: CheckIncapable :: NonEmpty MissingCapability -> CheckResult a
+ OptEnvConf.Check: CheckSucceeded :: a -> CheckResult a
+ OptEnvConf.Check: data CheckResult a

Files

CHANGELOG.md view
@@ -1,6 +1,13 @@ # Changelog -## [0.12.0.0] - 2025-11-25+## [0.12.2.0] - 2025-11-18++### Changed++* Fixed a bug in which parse errors would be ignored during checking as soon as+  one missing capability was encountered.++## [0.12.0.0] - 2025-11-15  ### Added 
opt-env-conf.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack  name:           opt-env-conf-version:        0.12.1.0+version:        0.12.2.0 synopsis:       Settings parsing for Haskell: command-line arguments, environment variables, and configuration values. homepage:       https://github.com/NorfairKing/opt-env-conf#readme bug-reports:    https://github.com/NorfairKing/opt-env-conf/issues
src/OptEnvConf/Check.hs view
@@ -6,13 +6,13 @@ module OptEnvConf.Check   ( runSettingsCheck,     runSettingsCheckOn,+    CheckResult (..),   ) where  import qualified Data.Aeson as JSON import Data.List.NonEmpty (NonEmpty (..)) import qualified Data.List.NonEmpty as NE-import Data.Maybe import GHC.Generics (Generic) import GHC.Stack (SrcLoc) import OptEnvConf.Args as Args@@ -80,13 +80,17 @@   pure $ case errOrSets of     Right a -> CheckSucceeded a     Left errs ->-      let missingCaps =-            mapMaybe+      -- If all the errors are missing capability errors, return+      -- CheckIncapable, otherwise CheckFailed+      let mMissingCaps =+            -- This MUST be mapM instead of mapMaybe because we need to ensure+            -- ALL errors are missing capability errors+            mapM               ( \case                   ParseError mLoc (ParseErrorMissingCapability cap) -> Just (MissingCapability mLoc cap)                   _ -> Nothing               )-              (NE.toList errs)-       in case NE.nonEmpty missingCaps of+              errs+       in case mMissingCaps of             Just ne -> CheckIncapable ne             Nothing -> CheckFailed errs
src/OptEnvConf/Run.hs view
@@ -215,7 +215,11 @@           debug ["check"]           -- Only perform the check (IO) if capabilities are sufficient           ppIndent $ case missingCapabilities capabilities requiredCapabilities of-            Just missings -> ppErrors mLoc $ NE.map ParseErrorMissingCapability missings+            Just missings -> do+              debug $+                "Missing capabilities: "+                  : capabilitiesChunks (Set.fromList (NE.toList missings))+              ppErrors mLoc $ NE.map ParseErrorMissingCapability missings             Nothing -> do               errOrB <- liftIO $ f a               case errOrB of