configuration-tools 0.2.12 → 0.2.13
raw patch · 10 files changed
+136/−120 lines, 10 filesdep +filepathdep −errorsdep ~mtldep ~mtl-compatdep ~optparse-applicativePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies added: filepath
Dependencies removed: errors
Dependency ranges changed: mtl, mtl-compat, optparse-applicative, transformers, transformers-compat
API changes (from Hackage documentation)
- Configuration.Utils: type Lens σ τ α β = Functor φ => (α -> φ β) -> σ -> φ τ
+ Configuration.Utils: type Lens σ τ α β = forall φ. Functor φ => (α -> φ β) -> σ -> φ τ
- Configuration.Utils: type ConfigValidation α λ = (MonadIO μ, Functor μ, Applicative μ, MonadError Text μ, MonadWriter (λ Text) μ) => α -> μ ()
+ Configuration.Utils: type ConfigValidation α λ = forall μ. (MonadIO μ, Functor μ, Applicative μ, MonadError Text μ, MonadWriter (λ Text) μ) => α -> μ ()
- Configuration.Utils.Internal: type Lens σ τ α β = Functor φ => (α -> φ β) -> σ -> φ τ
+ Configuration.Utils.Internal: type Lens σ τ α β = forall φ. Functor φ => (α -> φ β) -> σ -> φ τ
- Configuration.Utils.Internal: type Iso σ τ α β = (Profunctor π, Functor φ) => π α (φ β) -> π σ (φ τ)
+ Configuration.Utils.Internal: type Iso σ τ α β = forall π φ. (Profunctor π, Functor φ) => π α (φ β) -> π σ (φ τ)
- Configuration.Utils.Validation: type ConfigValidation α λ = (MonadIO μ, Functor μ, Applicative μ, MonadError Text μ, MonadWriter (λ Text) μ) => α -> μ ()
+ Configuration.Utils.Validation: type ConfigValidation α λ = forall μ. (MonadIO μ, Functor μ, Applicative μ, MonadError Text μ, MonadWriter (λ Text) μ) => α -> μ ()
Files
- CHANGELOG.md +17/−0
- configuration-tools.cabal +20/−39
- constraints +54/−61
- src/Configuration/Utils.hs +1/−1
- src/Configuration/Utils/Internal.hs +2/−2
- src/Configuration/Utils/Internal/ConfigFileReader.hs +5/−5
- src/Configuration/Utils/Maybe.hs +7/−4
- src/Configuration/Utils/Operators.hs +7/−0
- src/Configuration/Utils/Setup.hs +14/−7
- src/Configuration/Utils/Validation.hs +9/−1
CHANGELOG.md view
@@ -1,3 +1,20 @@+0.2.13+======++* Eliminate most compiler warnings when compiling with GHC-7.10.++* Bump lower bound on the version of `optparse-applicative` to `0.11.0.2`.+ This avoids issues when building with `transformers-compat`.++* Reduce compilation time with `text<1.2.0.5` by avoiding usage of `toCaseFold`+ from the `case-insensitive` package.++* Dropped dependency on the error package.++* [Issue 43](https://github.com/alephcloud/hs-configuration-tools/issues/43):+ Support detection of the version control system when the package directory+ and thus the cabal file is in sub-directory of the repository.+ 0.2.12 ======
configuration-tools.cabal view
@@ -1,9 +1,10 @@ -- ------------------------------------------------------ --+-- Copyright © 2015 Lars Kuhtz <lakuhtz@gmail.com> -- Copyright © 2014-2015 AlephCloud Systems, Inc. -- ------------------------------------------------------ -- Name: configuration-tools-Version: 0.2.12+Version: 0.2.13 Synopsis: Tools for specifying and parsing configurations description: Tools for specifying and parsing configurations@@ -31,9 +32,9 @@ Bug-reports: https://github.com/alephcloud/hs-configuration-tools/issues License: MIT License-file: LICENSE-Author: Lars Kuhtz <lars@alephcloud.com>-Maintainer: Lars Kuhtz <lars@alephcloud.com>-Copyright: Copyright (c) 2014-2015 AlephCloud, Inc.+Author: Lars Kuhtz <lakuhtz@gmail.com>+Maintainer: Lars Kuhtz <lakuhtz@gmail.com>+Copyright: Copyright (c) 2015 Lars Kuhtz <lakuhtz@gmail.com>, 2014-2015 AlephCloud, Inc. Category: Configuration, Console Build-type: Custom @@ -51,11 +52,12 @@ source-repository head type: git location: https://github.com/alephcloud/hs-configuration-tools.git+ branch: master source-repository this type: git location: https://github.com/alephcloud/hs-configuration-tools.git- tag: 0.2.12+ tag: 0.2.13 flag remote-configs Description: enable loading of configuration files from HTTP URLs@@ -67,14 +69,6 @@ Default: False Manual: False --- remove this as soon as optparse-applicative removes the upper bound--- on transformers-compat. cabal should realy drop support for upper--- bounds on dependencies of libraries...-flag compat-three- Description: use transformers-compat 0.3.*- Default: False- Manual: False- Library hs-source-dirs: src default-language: Haskell2010@@ -107,9 +101,9 @@ deepseq >= 1.3, directory >= 1.2.1.0, dlist >= 0.7.1,- errors >= 1.4.3,+ filepath >= 1.3.0.1, network-uri >= 2.6.0.1,- optparse-applicative >= 0.10,+ optparse-applicative >= 0.11.0.2, process >= 1.2.0.0, text >= 1.0, unordered-containers >= 0.2.4.0,@@ -117,18 +111,11 @@ profunctors >= 4.0.4 if flag(old-transformers)- if flag(compat-three)- build-depends:- mtl >= 2.1,- mtl-compat < 0.2,- transformers >= 0.3 && < 0.4,- transformers-compat >= 0.3 && < 0.4- else- build-depends:- mtl >= 2.1,- mtl-compat >= 0.2,- transformers >= 0.3 && < 0.4,- transformers-compat >= 0.4+ build-depends:+ mtl >= 2.1,+ mtl-compat >= 0.2,+ transformers >= 0.3 && < 0.4,+ transformers-compat >= 0.4 else build-depends: mtl >= 2.2,@@ -172,25 +159,19 @@ bytestring >= 0.10, Cabal >= 1.18, configuration-tools,- errors >= 1.4.3, text >= 1.0, unordered-containers >= 0.2.4.0, yaml >= 0.8.8.3 if flag(old-transformers)- if flag(compat-three)- build-depends:- mtl >= 2.1 && < 2.2,- mtl-compat < 0.2,- transformers-compat >= 0.3 && < 0.4- else- build-depends:- mtl >= 2.1,- mtl-compat >= 0.2,- transformers-compat >= 0.4+ build-depends:+ mtl >= 2.1,+ mtl-compat >= 0.2,+ transformers-compat >= 0.4 else build-depends:- mtl >= 2.2+ mtl >= 2.2,+ transformers >= 0.4 if flag(remote-configs) build-depends:
constraints view
@@ -1,37 +1,37 @@-constraints: Cabal ==1.18.1.3,- MonadRandom ==0.3.0.1,- aeson ==0.8.0.2,+constraints: Cabal ==1.22.3.0,+ StateVar ==1.1.0.0,+ aeson ==0.9.0.1, ansi-terminal ==0.6.2.1,- ansi-wl-pprint ==0.6.7.1,- array ==0.5.0.0,+ ansi-wl-pprint ==0.6.7.2,+ array ==0.5.1.0, asn1-encoding ==0.9.0,- asn1-parse ==0.9.0,+ asn1-parse ==0.9.1, asn1-types ==0.3.0, async ==2.0.2,- attoparsec ==0.12.1.2,- base ==4.7.0.1,+ attoparsec ==0.13.0.0,+ base ==4.8.0.0, base-unicode-symbols ==0.2.2.4, base64-bytestring ==1.0.0.1,- bifunctors ==4.2,- blaze-builder ==0.3.3.4,+ binary ==0.7.3.0,+ blaze-builder ==0.4.0.1, byteable ==0.1.1,- bytestring ==0.10.4.0,+ bytestring ==0.10.6.0, case-insensitive ==1.2.0.4, cereal ==0.4.1.1, cipher-aes ==0.2.10, cipher-des ==0.0.6, cipher-rc4 ==0.1.4,- comonad ==4.2.2,- conduit ==1.2.3.1,+ comonad ==4.2.6,+ conduit ==1.2.4.2, connection ==0.2.4,- containers ==0.5.5.1,- contravariant ==1.2.0.1,- cookie ==0.4.1.4,+ containers ==0.5.6.2,+ contravariant ==1.3.1.1,+ cookie ==0.4.1.5, crypto-cipher-types ==0.0.9, crypto-numbers ==0.2.7, crypto-pubkey ==0.2.8, crypto-pubkey-types ==0.4.3,- crypto-random ==0.0.8,+ crypto-random ==0.0.9, cryptohash ==0.11.6, data-default ==0.5.3, data-default-class ==0.0.1,@@ -39,69 +39,62 @@ data-default-instances-containers ==0.0.1, data-default-instances-dlist ==0.0.1, data-default-instances-old-locale ==0.0.1,- deepseq ==1.3.0.2,- directory ==1.2.1.0,+ deepseq ==1.4.1.1,+ directory ==1.2.2.0, distributive ==0.4.4,- dlist ==0.7.1,- either ==4.3.3.2,- enclosed-exceptions ==1.0.1,- errors ==1.4.7,- exceptions ==0.8,- filepath ==1.3.0.2,- free ==4.10.0.1,- ghc-prim ==0.3.1.0,- hashable ==1.2.3.1,- hourglass ==0.2.8,- http-client ==0.4.7.1,+ dlist ==0.7.1.1,+ enclosed-exceptions ==1.0.1.1,+ exceptions ==0.8.0.2,+ filepath ==1.4.0.0,+ ghc-prim ==0.4.0.0,+ hashable ==1.2.3.2,+ hourglass ==0.2.9,+ http-client ==0.4.11.2, http-client-tls ==0.2.2, http-types ==0.8.6,- integer-gmp ==0.5.1.0,+ integer-gmp ==1.0.0.0, lifted-base ==0.2.3.6,- mime-types ==0.1.0.5,+ memory ==0.6,+ mime-types ==0.1.0.6, mmorph ==1.0.4, monad-control ==1.0.0.4, mtl ==2.2.1, nats ==1,- network ==2.6.0.2,- network-uri ==2.6.0.1,- old-locale ==1.0.0.6,+ network ==2.6.1.0,+ network-uri ==2.6.0.3,+ old-locale ==1.0.0.7, optparse-applicative ==0.11.0.2,- parsec ==3.1.8,+ parsec ==3.1.9, pem ==0.2.2,- prelude-extras ==0.4,- pretty ==1.1.1.1,- primitive ==0.5.4.0,- process ==1.2.0.0,- profunctors ==4.3.2,- publicsuffixlist ==0.1,+ pretty ==1.1.2.0,+ primitive ==0.6,+ process ==1.2.3.0,+ profunctors ==5.1.1, random ==1.1,- resourcet ==1.1.4.1,+ resourcet ==1.1.5, rts ==1.0,- safe ==0.3.8,- scientific ==0.3.3.7,- securemem ==0.1.7,- semigroupoids ==4.3,- semigroups ==0.16.1,+ scientific ==0.3.3.8,+ securemem ==0.1.8,+ semigroups ==0.16.2.2, socks ==0.5.4, stm ==2.4.4,- streaming-commons ==0.1.9.1,- syb ==0.4.4,- tagged ==0.7.3,- template-haskell ==2.9.0.0,- text ==1.2.0.4,- time ==1.4.2,- tls ==1.2.16,+ streaming-commons ==0.1.12.1,+ syb ==0.5.1,+ tagged ==0.8.0.1,+ template-haskell ==2.10.0.0,+ text ==1.2.1.0,+ time ==1.5.0.1,+ tls ==1.2.17, transformers ==0.4.2.0, transformers-base ==0.4.4, transformers-compat ==0.4.0.4,- unix ==2.7.0.1,+ unix ==2.7.1.0, unordered-containers ==0.2.5.1,- utf8-string ==1,- vector ==0.10.12.2,+ vector ==0.10.12.3, void ==0.7,- x509 ==1.5.0.1,+ x509 ==1.5.1, x509-store ==1.5.0, x509-system ==1.5.0,- x509-validation ==1.5.1,- yaml ==0.8.10.1,+ x509-validation ==1.5.2,+ yaml ==0.8.11, zlib ==0.5.4.2
src/Configuration/Utils.hs view
@@ -548,7 +548,7 @@ -- this parser produces the results <*> pAppConfiguration _piOptionParser - -- the 'O.helper' option from optparse-applicative is hidden be default+ -- the 'O.helper' option from optparse-applicative is hidden by default -- which seems a bit weired. This option doesn't hide the access to help. nonHiddenHelper = abortOption ShowHelpText × long "help"
src/Configuration/Utils/Internal.hs view
@@ -62,7 +62,7 @@ -- In case it is already import from the lens package this should be hidden -- from the import. ---type Lens σ τ α β = Functor φ ⇒ (α → φ β) → σ → φ τ+type Lens σ τ α β = ∀ φ . Functor φ ⇒ (α → φ β) → σ → φ τ -- | This is the same type as the type from the lens library with the same name. --@@ -92,7 +92,7 @@ -- In case it is already import from the lens package this should be hidden -- from the import. ---type Iso σ τ α β = (Profunctor π, Functor φ) ⇒ π α (φ β) → π σ (φ τ)+type Iso σ τ α β = ∀ π φ . (Profunctor π, Functor φ) ⇒ π α (φ β) → π σ (φ τ) type Iso' σ α = Iso σ σ α α iso ∷ (σ → α) → (β → τ) → Iso σ τ α β
src/Configuration/Utils/Internal/ConfigFileReader.hs view
@@ -47,7 +47,6 @@ import Control.Monad.Error.Class import qualified Data.ByteString.Char8 as B8-import qualified Data.CaseInsensitive as CI import Data.Monoid.Unicode import qualified Data.Text as T import Data.Typeable@@ -65,6 +64,7 @@ import Control.Monad.Trans.Control import qualified Data.ByteString.Lazy as LB+import qualified Data.CaseInsensitive as CI import qualified Data.List as L import Data.String import qualified Data.Text.IO as T@@ -121,10 +121,10 @@ fileType ∷ T.Text → ConfigFileFormat fileType f- | CI.foldCase ".yaml" `T.isSuffixOf` CI.foldCase f = Yaml- | CI.foldCase ".yml" `T.isSuffixOf` CI.foldCase f = Yaml- | CI.foldCase ".json" `T.isSuffixOf` CI.foldCase f = Json- | CI.foldCase ".js" `T.isSuffixOf` CI.foldCase f = Json+ | ".yaml" `T.isSuffixOf` T.toLower f = Yaml+ | ".yml" `T.isSuffixOf` T.toLower f = Yaml+ | ".json" `T.isSuffixOf` T.toLower f = Json+ | ".js" `T.isSuffixOf` T.toLower f = Json | otherwise = Other loadLocal
src/Configuration/Utils/Maybe.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE LambdaCase #-}@@ -7,6 +8,10 @@ {-# OPTIONS_GHC -fno-warn-orphans #-} +#ifndef MIN_VERSION_base+#define MIN_VERSION_base(x,y,z) 1+#endif+ -- | -- Module: Configuration.Utils.Maybe -- Description: Configuration of Optional Values@@ -28,7 +33,9 @@ ) where +#if ! MIN_VERSION_base(4,8,0) import Control.Applicative+#endif import Data.Aeson -- -------------------------------------------------------------------------- --@@ -73,11 +80,7 @@ -- -- > pLogConfig ∷ MParser LogConfig -- > pLogConfig = id--- > #if MIN_VERSION_optparse-applicative(0,10,0) -- > <$< logLevel .:: option auto--- > #else--- > <$< logLevel .:: option--- > #endif -- > % long "log-level" -- > % metavar "INTEGER" -- > % help "log level"
src/Configuration/Utils/Operators.hs view
@@ -1,8 +1,13 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE UnicodeSyntax #-} +#ifndef MIN_VERSION_base+#define MIN_VERSION_base(x,y,z) 1+#endif+ -- | -- Module: Configuration.Utils.Operators -- Description: Useful operators for defining functions in an applicative context@@ -24,7 +29,9 @@ , (⊙) ) where +#if ! MIN_VERSION_base(4,8,0) import Control.Applicative+#endif -- -------------------------------------------------------------------------- -- -- Useful Operators
src/Configuration/Utils/Setup.hs view
@@ -129,7 +129,8 @@ import Prelude hiding (readFile, writeFile) -import System.Directory (doesFileExist, doesDirectoryExist, createDirectoryIfMissing)+import System.Directory (doesFileExist, doesDirectoryExist, createDirectoryIfMissing, getCurrentDirectory, canonicalizePath)+import System.FilePath (isDrive, (</>), takeDirectory) import System.Exit (ExitCode(ExitSuccess)) #ifndef MIN_VERSION_Cabal@@ -204,12 +205,18 @@ where f = reverse . dropWhile isSpace getVCS :: IO (Maybe RepoType)-getVCS =- doesDirectoryExist ".hg" >>= \x0 -> if x0+getVCS = getCurrentDirectory >>= getVcsOfDir++getVcsOfDir :: FilePath -> IO (Maybe RepoType)+getVcsOfDir d = do+ canonicDir <- canonicalizePath d+ doesDirectoryExist (canonicDir </> ".hg") >>= \x0 -> if x0 then return (Just Mercurial)- else doesDirectoryExist ".git" >>= \x1 -> return $ if x1- then Just Git- else Nothing+ else doesDirectoryExist (canonicDir </> ".git") >>= \x1 -> if x1+ then return $ Just Git+ else if isDrive canonicDir+ then return Nothing+ else getVcsOfDir (takeDirectory canonicDir) flagNameStr :: FlagName -> String flagNameStr (FlagName s) = s@@ -372,7 +379,7 @@ -- getLicenseFiles :: PackageDescription -> [FilePath] getLicenseFiles (PackageDescription _ _ l _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) =- fromMaybe (error "unsupport Cabal library version") $ cast l <|> (return <$> cast l)+ fromMaybe (error "unsupported Cabal library version") $ cast l <|> (return <$> cast l) #endif hgInfo :: IO (String, String, String)
src/Configuration/Utils/Validation.hs view
@@ -6,6 +6,10 @@ {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE UnicodeSyntax #-} +#ifndef MIN_VERSION_base+#define MIN_VERSION_base(x,y,z) 1+#endif+ -- | -- Module: Configuration.Utils.Validation -- Copyright: Copyright © 2014 AlephCloud Systems, Inc.@@ -67,14 +71,18 @@ import Configuration.Utils.Internal +#if ! MIN_VERSION_base(4,8,0) import Control.Applicative+#endif import Control.Monad.Error.Class import Control.Monad import Control.Monad.IO.Class import Control.Monad.Writer.Class import qualified Data.Foldable as F+#if ! MIN_VERSION_base(4,8,0) import Data.Monoid+#endif import Data.Monoid.Unicode import qualified Data.Text as T @@ -87,7 +95,7 @@ -- | A validation function. The type in the 'MonadWriter' is excpected to -- be a 'Foldable' structure for collecting warnings. ---type ConfigValidation α λ = (MonadIO μ, Functor μ, Applicative μ, MonadError T.Text μ, MonadWriter (λ T.Text) μ) ⇒ α → μ ()+type ConfigValidation α λ = ∀ μ . (MonadIO μ, Functor μ, Applicative μ, MonadError T.Text μ, MonadWriter (λ T.Text) μ) ⇒ α → μ () -- -------------------------------------------------------------------------- -- -- Networking