packages feed

envy 1.3.0.2 → 1.5.0.0

raw patch · 3 files changed

+14/−5 lines, 3 filesdep ~QuickCheckdep ~hspecdep ~quickcheck-instancesPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: QuickCheck, hspec, quickcheck-instances

API changes (from Hackage documentation)

- System.Envy: instance System.Envy.Var Data.Time.Clock.UTC.UTCTime
+ System.Envy: Parser :: ExceptT String IO a -> Parser a
+ System.Envy: [runParser] :: Parser a -> ExceptT String IO a
+ System.Envy: instance System.Envy.Var ()
+ System.Envy: instance System.Envy.Var Data.Time.Clock.Internal.UTCTime.UTCTime
+ System.Envy: instance System.Envy.Var a => System.Envy.Var (GHC.Base.Maybe a)
+ System.Envy: newtype Parser a
- System.Envy: class FromEnv a where fromEnv = gFromEnvCustom defOption
+ System.Envy: class FromEnv a

Files

envy.cabal view
@@ -1,5 +1,5 @@ name:                envy-version:             1.3.0.2+version:             1.5.0.0 synopsis:            An environmentally friendly way to deal with environment variables license:             BSD3 license-file:        LICENSE@@ -37,10 +37,10 @@     build-depends:      base                       , bytestring                       , envy-                      , hspec                >= 2.2 && < 2.5+                      , hspec                       , mtl-                      , quickcheck-instances == 0.3.*-                      , QuickCheck           >= 2.8 && < 2.10+                      , quickcheck-instances+                      , QuickCheck                       , text                       , time                       , transformers
src/System/Envy.hs view
@@ -13,7 +13,7 @@ -- | -- Module      : System.Envy -- Copyright   : (c) David Johnson 2015--- Maintainer  : djohnson.m@ngmail.com+-- Maintainer  : djohnson.m@gmail.com -- Stability   : experimental -- Portability : POSIX --@@ -49,6 +49,7 @@        , ToEnv   (..)        , Var     (..)        , EnvList+       , Parser  (..)         -- * Functions        , decodeEnv        , decode@@ -67,6 +68,7 @@        , Option (..)        , runEnv        , gFromEnvCustom+       , runParser        ) where ------------------------------------------------------------------------------ import           Control.Applicative@@ -286,6 +288,11 @@ instance Var Word32 where toVar = show; fromVar = readMaybe instance Var Word64 where toVar = show; fromVar = readMaybe instance Var String where toVar = id; fromVar = Just+instance Var () where toVar = const "()"; fromVar = const $ Just ()+instance Var a => Var (Maybe a) where+  toVar = maybe "" toVar+  fromVar "" = Nothing+  fromVar  s = Just <$> fromVar s  ------------------------------------------------------------------------------ -- | Environment retrieval with failure info
tests/Main.hs view
@@ -105,6 +105,8 @@      \(x :: LT.Text) -> Just x == fromVar (toVar x)     it "Text Var isomorphism" $ property $      \(x :: T.Text) -> Just x == fromVar (toVar x)+    it "() Var isomorphism" $ property $+     \(x :: ()) -> Just x == fromVar (toVar x)   describe "Can set to and from environment" $     it "Isomorphism through setEnvironment['] and decodeEnv" $ property $       \(pgConf::PGConfig) -> monadicIO $ do