packages feed

envy 1.0.0.0 → 1.1.0.0

raw patch · 3 files changed

+25/−8 lines, 3 filesdep ~envyPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: envy

API changes (from Hackage documentation)

- System.Envy: fromEnvCustom :: (FromEnv a, DefConfig a, Generic a, GFromEnv (Rep a)) => Option -> Parser a
+ System.Envy: gFromEnvCustom :: (DefConfig a, Generic a, GFromEnv (Rep a)) => Option -> Parser a
+ System.Envy: runEnv :: Parser a -> IO (Either String a)
- System.Envy: class FromEnv a where fromEnvCustom opts = to <$> gFromEnv (from (defConfig :: a)) opts fromEnv = fromEnvCustom defOption
+ System.Envy: class FromEnv a where fromEnv = gFromEnvCustom defOption

Files

README.md view
@@ -106,7 +106,7 @@ 		<*> env "PG_PORT" 		<*> env "PG_USER" 		<*> env "PG_PASS"-		<*> env "PG_DB")+		<*> env "PG_DB"  ------------------------------------------------------------------------------ -- | To Environment Instances
envy.cabal view
@@ -1,9 +1,9 @@ name:                envy-version:             1.0.0.0+version:             1.1.0.0 synopsis:            An environmentally friendly way to deal with environment variables license:             BSD3 license-file:        LICENSE-author:              David Johnson, Tim Adams+author:              David Johnson, Tim Adams, Eric Mertens maintainer:          djohnson.m@gmail.com copyright:           David Johnson (c) 2015 category:            System@@ -36,7 +36,7 @@     main-is:            Main.hs     build-depends:      base                 >= 4.7 && < 5                       , bytestring           == 0.10.*-                      , envy                 == 1.0.*+                      , envy                 == 1.1.*                       , hspec                == 2.2.*                       , mtl                  == 2.2.*                       , quickcheck-instances == 0.3.*
src/System/Envy.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE RecordWildCards            #-} {-# LANGUAGE TypeOperators              #-} {-# LANGUAGE FlexibleContexts           #-}@@ -62,6 +63,8 @@          -- * Generics        , DefConfig (..)        , Option (..)+       , runEnv+       , gFromEnvCustom        ) where ------------------------------------------------------------------------------ import           Control.Applicative@@ -94,10 +97,18 @@  ------------------------------------------------------------------------------ -- | Executes `Parser`-evalParser :: FromEnv a => Parser a -> IO (Either String a)+evalParser :: Parser a -> IO (Either String a) evalParser = runExceptT . runParser  ------------------------------------------------------------------------------+-- | For use with Generics, no `FromEnv` typeclass necessary+--+-- > getPgConfig :: IO (Either String ConnectInfo)+-- > getPgConfig = runEnv $ gFromEnvCustom defOption+runEnv :: Parser a -> IO (Either String a)+runEnv = runExceptT . runParser++------------------------------------------------------------------------------ -- | Environment variable getter getE   :: forall a . (Typeable a, Var a)@@ -160,11 +171,17 @@ -- | `FromEnv` Typeclass w/ Generic default implementation class FromEnv a where   fromEnv :: Parser a-  fromEnvCustom :: (DefConfig a, Generic a, GFromEnv (Rep a)) => Option -> Parser a-  fromEnvCustom opts = to <$> gFromEnv (from (defConfig :: a)) opts   default fromEnv :: (DefConfig a, Generic a, GFromEnv (Rep a)) => Parser a-  fromEnv = fromEnvCustom defOption+  fromEnv = gFromEnvCustom defOption +------------------------------------------------------------------------------+-- | Meant for specifying a custom `Option` for environment retrieval+--+-- > instance FromEnv PGConfig where+-- >   fromEnv = gFromEnvCustom Option { dropPrefixCount = 8, customPrefix = "PG" }+--+gFromEnvCustom :: forall a . (DefConfig a, Generic a, GFromEnv (Rep a)) => Option -> Parser a+gFromEnvCustom opts = to <$> gFromEnv (from (defConfig :: a)) opts ------------------------------------------------------------------------------ -- | `Generic` FromEnv class GFromEnv f where