packages feed

effectful-config-file 0.1.0.2 → 0.1.1.0

raw patch · 4 files changed

+25/−1 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Data.Config: instance Data.Config.ConfigParse Data.Text.Internal.Text
+ Data.Config: instance Toml.Schema.FromValue.FromValue (Data.Config.ConfigValue Data.Text.Internal.Text)

Files

CHANGELOG.md view
@@ -1,3 +1,9 @@+## [1.1.0](https://github.com/haskell-github-trust/effectful-config-file/compare/1.0.2...1.1.0) (2026-10-25)++### Features++* add `Text` base value support ([227a15e](https://github.com/haskell-github-trust/effectful-config-file/commit/227a15e25d2d7c5bb950472ac6f7aa7ce8ecaf29))+ ## [1.0.2](https://github.com/haskell-github-trust/effectful-config-file/compare/1.0.1...1.0.2) (2026-10-20)  ## [1.0.1](https://github.com/haskell-github-trust/effectful-config-file/compare/1.0.0...1.0.1) (2026-10-18)
effectful-config-file.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack  name:           effectful-config-file-version:        0.1.0.2+version:        0.1.1.0 synopsis:       Config-file effect for effectful description:    Config-file parser and utilities to use in conjunction with effectful category:       Configuration
src/Data/Config.hs view
@@ -70,6 +70,9 @@ instance ConfigParse String where   parse = T.unpack +instance ConfigParse Text where+  parse = id+ -- | Class to fetch values from different sources. class ConfigFetch a where   fetch@@ -121,6 +124,9 @@ parseTextValue _ = fail "must be text value"  instance {-# OVERLAPPING #-} FromValue (ConfigValue String) where+  fromValue = parseTextValue++instance {-# OVERLAPPING #-} FromValue (ConfigValue Text) where   fromValue = parseTextValue  instance (FromValue a, Typeable a) => FromValue (ConfigValue a) where
test/Effectful/ConfigSpec.hs view
@@ -14,6 +14,7 @@ import Data.Bifunctor (Bifunctor (..), first) import Data.Config (ConfigValue (..), withSection) import Data.Error.Config (ConfigError (..))+import Data.Text (Text) import qualified Data.Text as T (isInfixOf, pack, unlines, unpack) import Effectful (runEff) import Effectful.Config (getConfigValue, readConfig, readConfig')@@ -83,6 +84,12 @@  makeLenses ''FileConfig +newtype TextConfig = TextConfig (ConfigValue Text)+  deriving (Eq, Show)++instance FromValue TextConfig where+  fromValue = withSection "text" $ TextConfig <$> reqKey "v"+ instance Functor (Result e) where   fmap _ (Failure e) = Failure e   fmap f (Success e a) = Success e (f a)@@ -113,6 +120,11 @@      it "fetch" $ do       result `shouldBe` Right (42, "test")++  describe "Text config value" $ do+    it "parses literal and env" $ do+      readConfig "[text]\nv = \"test\"" `shouldBe` Right (TextConfig (Literal "test"))+      readConfig "[text]\nv = \"env://X\"" `shouldBe` Right (TextConfig (Env "X"))    describe "readConfig" $ do     let result = TestConfig (Literal 42) (Literal "test")