cfg 0.0.2.0 → 0.0.2.1
raw patch · 2 files changed
+32/−20 lines, 2 filesdep ~basedep ~bytestringdep ~containersPVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
Dependency ranges changed: base, bytestring, containers, errors, free, hedgehog, hspec, hspec-core, hspec-discover, hspec-expectations, megaparsec, mtl, pretty-simple, text, vector
API changes (from Hackage documentation)
+ Cfg: instance Cfg.Parser.ConfigParser Cfg.AppConfig5
+ Cfg: instance Cfg.Source.ConfigSource Cfg.AppConfig5
+ Cfg: instance Cfg.Source.Default.DefaultSource Cfg.AppConfig5
+ Cfg: instance GHC.Generics.Generic Cfg.AppConfig5
+ Cfg: instance GHC.Show.Show Cfg.AppConfig5
Files
- cfg.cabal +16/−16
- src/Cfg.hs +16/−4
cfg.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: cfg-version: 0.0.2.0+version: 0.0.2.1 synopsis: Type directed application configuration parsing and accessors @@ -59,22 +59,22 @@ UndecidableInstances build-depends:- , base >=4.18.0 && <4.19- , containers >=0.6.7 && <0.7- , free >=5.1.10 && <5.2- , mtl >=2.3.1 && <2.4- , pretty-simple >=4.1.2 && <4.2- , text >=2.0.2 && <2.1+ , base >=4.16.0 && <4.19+ , containers >=0.6 && <0.7+ , free >=5.0.1 && <5.2+ , mtl >=2.1 && <2.4+ , pretty-simple >=4.0 && <4.2+ , text >=2.0 && <2.1 default-language: Haskell2010 library import: common-opts build-depends:- , bytestring >=0.11.4 && <0.12- , errors >=2.3.0 && <2.4- , megaparsec >=9.2.2 && <9.3- , vector >=0.12.3 && <0.13+ , bytestring >=0.11 && <0.12+ , errors >=2.0.0 && <2.4+ , megaparsec >=9.0.0 && <9.5+ , vector >=0.12.0 && <0.14 -- cabal-fmt: expand src exposed-modules:@@ -118,11 +118,11 @@ build-depends: , cfg- , hedgehog >=1.2 && <1.3- , hspec >=2.9.7 && <2.10- , hspec-core >=2.9.7 && <2.10- , hspec-discover >=2.9.7 && <2.10- , hspec-expectations >=0.8.2 && <0.9+ , hedgehog >=1.1 && <1.3+ , hspec >=2.9 && <2.12+ , hspec-core >=2.9 && <2.12+ , hspec-discover >=2.9 && <2.12+ , hspec-expectations >=0.7.0 && <0.9 , hspec-hedgehog >=0.0.1 && <0.1 test-suite documentation
src/Cfg.hs view
@@ -279,9 +279,7 @@ -- 'DefaultSource' instance for the record that contains the value you want -- to default. The reason the defaulting needs to be defined on the record -- is that we use the record field key to identify the defaulted value the- -- value you want to default. The reason the defaulting needs to be defined- -- on the record is that we use the record field key to identify the- -- defaulted value.+ -- value you want to default. -- -- __There are a bunch of gotchas with defaulting__: --@@ -319,7 +317,7 @@ -- -- NOTE: If I provide a default for WarpConfig or RedisConfig this will break the configuration machinery -- -- so I only match on the field for @Environment@ --- -- instance 'DefaultSource' (AppConfig a) where+ -- instance 'DefaultSource' AppConfig where -- 'defaults' "appConfigEnvironment" = Just "Development" -- 'defaults' _ = Nothing -- @@@ -468,3 +466,17 @@ [StripPrefix "appConfig", StripSuffix "Settings", ToUpper] AppConfig4 )++-- Example 5+data AppConfig5 = AppConfig5+ { appConfigWarpSettings :: WarpConfig+ , appConfigRedisSettings :: RedisConfig+ , appConfigEnvironment :: Environment+ }+ deriving (Generic, Show)+ deriving (ConfigSource, ConfigParser)+ via (ConfigOpts [StripPrefix "appConfig", StripSuffix "Settings", ToUpper] AppConfig5)++instance DefaultSource AppConfig5 where+ defaults "appConfigEnvironment" = Just "Development"+ defaults _ = Nothing