config-value-getopt 0.1.1.0 → 0.1.1.1
raw patch · 3 files changed
+15/−7 lines, 3 filesdep ~basedep ~config-valuePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, config-value
API changes (from Hackage documentation)
Files
- CHANGELOG.md +4/−0
- config-value-getopt.cabal +3/−3
- src/Config/GetOpt.hs +8/−4
CHANGELOG.md view
@@ -1,3 +1,7 @@+0.1.1.1+-------+* Support `config-value-0.7`+ 0.1.1.0 ------- * Support `config-value-0.6`
config-value-getopt.cabal view
@@ -1,5 +1,5 @@ name: config-value-getopt-version: 0.1.1.0+version: 0.1.1.1 synopsis: Interface between config-value and System.GetOpt description: This package allows to set command line configuration options from a file using the config-value syntax.@@ -25,8 +25,8 @@ library exposed-modules: Config.GetOpt- build-depends: base >=4.8 && <4.11,+ build-depends: base >=4.8 && <4.14, text >=1.2.1.3 && <1.3,- config-value >=0.6 && <0.7+ config-value >=0.7 && <0.8 hs-source-dirs: src default-language: Haskell2010
src/Config/GetOpt.hs view
@@ -3,6 +3,7 @@ module Config.GetOpt (configValueGetOpt) where import Config+import Config.Number import Data.Either (partitionEithers) import Data.Foldable (find)@@ -55,10 +56,13 @@ Just x -> Right (f x) Nothing -> Left (k ++ ": invalid parameter") -valueString :: Value p -> Maybe String-valueString (Text _ t) = Just (Text.unpack t)-valueString (Number _ 10 n) = Just (show n)-valueString _ = Nothing+valueString :: Value p -> Maybe String+valueString (Number _ n)+ | Radix10 0 <- numberRadix n+ , Just i <- numberToInteger n+ = Just (show i)+valueString (Text _ t) = Just (Text.unpack t)+valueString _ = Nothing lookupOption :: String -> [OptDescr a] -> Maybe (OptDescr a) lookupOption name = find $ \o -> name `elem` optionLongNames o