amazonka-core 0.3.1 → 0.3.2
raw patch · 5 files changed
+94/−27 lines, 5 filesdep +old-localedep ~aesondep ~time
Dependencies added: old-locale
Dependency ranges changed: aeson, time
Files
- amazonka-core.cabal +32/−19
- src/Network/AWS/Compat/Internal/Locale.hs +22/−0
- src/Network/AWS/Compat/Internal/Time.hs +24/−0
- src/Network/AWS/Data/Internal/Time.hs +10/−2
- test/Test/AWS/Data/Time.hs +6/−6
amazonka-core.cabal view
@@ -1,5 +1,5 @@ name: amazonka-core-version: 0.3.1+version: 0.3.2 synopsis: Core functionality and data types for Amazonka libraries. homepage: https://github.com/brendanhay/amazonka license: OtherLicense@@ -24,9 +24,13 @@ heavy development and not intended for public consumption, caveat emptor! source-repository head- type: git- location: git://github.com/brendanhay/amazonka.git+ type: git+ location: git://github.com/brendanhay/amazonka.git +flag old-locale+ description: Use old-locale and time < 1.5+ default: False+ library default-language: Haskell2010 hs-source-dirs: src@@ -49,7 +53,9 @@ , Network.AWS.Waiters other-modules:- Network.AWS.Data.Internal.Base64+ Network.AWS.Compat.Internal.Locale+ , Network.AWS.Compat.Internal.Time+ , Network.AWS.Data.Internal.Base64 , Network.AWS.Data.Internal.Body , Network.AWS.Data.Internal.ByteString , Network.AWS.Data.Internal.Header@@ -70,38 +76,46 @@ , Network.AWS.Signing.Internal.V4 build-depends:- aeson == 0.8.*- , attoparsec >= 0.12 && < 0.15- , base >= 4.7 && < 5- , base16-bytestring >= 0.1 && < 1- , base64-bytestring >= 1 && < 2- , bifunctors >= 4.1 && < 5+ aeson > 0.7.0.6 && < 0.9+ , attoparsec >= 0.12 && < 0.15+ , base >= 4.7 && < 5+ , base16-bytestring >= 0.1 && < 1+ , base64-bytestring >= 1 && < 2+ , bifunctors >= 4.1 && < 5 , bytestring >= 0.9- , case-insensitive >= 1.2 && < 2- , conduit >= 1.1 && < 1.3+ , case-insensitive >= 1.2 && < 2+ , conduit >= 1.1 && < 1.3 , conduit-extra == 1.1.* , cryptohash == 0.11.* , data-default-class >= 0.0.1 , hashable >= 1.2- , http-client >= 0.4.3 && < 0.5+ , http-client >= 0.4.3 && < 0.5 , http-types >= 0.8- , lens >= 4.4 && < 5- , mmorph >= 1 && < 2- , mtl >= 2.2.1 && < 2.3+ , lens >= 4.4 && < 5+ , mmorph >= 1 && < 2+ , mtl >= 2.2.1 && < 2.3 , resourcet == 1.1.* , scientific == 0.3.* , semigroups >= 0.12 , tagged >= 0.7 , text >= 1.1- , time >= 1.5 , transformers == 0.4.* , unordered-containers >= 0.2.5 , vector >= 0.10.9 , xml-conduit == 1.2.* if !impl(ghc>=7.9)- build-depends: nats >= 0.1.3+ build-depends:+ nats >= 0.1.3 + if flag(old-locale)+ build-depends:+ old-locale == 1.*+ , time >= 1.2 && < 1.5+ else+ build-depends:+ time >= 1.5 && < 1.6+ test-suite tests type: exitcode-stdio-1.0 default-language: Haskell2010@@ -127,4 +141,3 @@ , tasty-hunit , template-haskell , text- , time
+ src/Network/AWS/Compat/Internal/Locale.hs view
@@ -0,0 +1,22 @@+{-# LANGUAGE CPP #-}++-- Module : Network.AWS.Data.Compat.Internal.Locale+-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>+-- License : This Source Code Form is subject to the terms of+-- the Mozilla Public License, v. 2.0.+-- A copy of the MPL can be found in the LICENSE file or+-- you can obtain it at http://mozilla.org/MPL/2.0/.+-- Maintainer : Brendan Hay <brendan.g.hay@gmail.com>+-- Stability : experimental+-- Portability : non-portable (GHC extensions)++module Network.AWS.Compat.Internal.Locale+ ( defaultTimeLocale+ , iso8601DateFormat+ ) where++#if MIN_VERSION_time(1,5,0)+import Data.Time.Format (defaultTimeLocale, iso8601DateFormat)+#else+import System.Locale (defaultTimeLocale, iso8601DateFormat)+#endif
+ src/Network/AWS/Compat/Internal/Time.hs view
@@ -0,0 +1,24 @@+{-# LANGUAGE CPP #-}++-- Module : Network.AWS.Compat.Internal.Time+-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>+-- License : This Source Code Form is subject to the terms of+-- the Mozilla Public License, v. 2.0.+-- A copy of the MPL can be found in the LICENSE file or+-- you can obtain it at http://mozilla.org/MPL/2.0/.+-- Maintainer : Brendan Hay <brendan.g.hay@gmail.com>+-- Stability : experimental+-- Portability : non-portable (GHC extensions)++module Network.AWS.Compat.Internal.Time+ ( parseTime+ ) where++#if MIN_VERSION_time(1,5,0)+import Data.Time.Format (ParseTime, TimeLocale, parseTimeM)++parseTime :: ParseTime a => TimeLocale -> String -> String -> Maybe a+parseTime = parseTimeM True+#else+import Data.Time.Format (parseTime)+#endif
src/Network/AWS/Data/Internal/Time.hs view
@@ -29,6 +29,10 @@ , BasicTime , AWSTime , POSIX++ , parseTime+ , defaultTimeLocale+ , iso8601DateFormat ) where import Control.Applicative@@ -40,8 +44,12 @@ import Data.Scientific import Data.Tagged import qualified Data.Text as Text-import Data.Time+import Data.Time (UTCTime) import Data.Time.Clock.POSIX+import Data.Time.Format (formatTime)+import Network.AWS.Compat.Internal.Locale (defaultTimeLocale,+ iso8601DateFormat)+import Network.AWS.Compat.Internal.Time (parseTime) import Network.AWS.Data.Internal.ByteString import Network.AWS.Data.Internal.JSON import Network.AWS.Data.Internal.Query@@ -102,7 +110,7 @@ parseFormattedTime :: forall a. TimeFormat (Time a) => Parser (Time a) parseFormattedTime = do x <- Text.unpack <$> AText.takeText- p (parseTimeM True defaultTimeLocale (untag f) x) x+ p (parseTime defaultTimeLocale (untag f) x) x where p :: Maybe UTCTime -> String -> Parser (Time a) p Nothing s = fail ("Unable to parse " ++ untag f ++ " from " ++ s)
test/Test/AWS/Data/Time.hs view
@@ -15,12 +15,12 @@ module Test.AWS.Data.Time (tests) where -import Data.Aeson-import Data.Time-import Network.AWS.Prelude-import Test.AWS.Types-import Test.Tasty-import Test.Tasty.HUnit+import Data.Aeson+import Network.AWS.Data+import Network.AWS.Prelude+import Test.AWS.Types+import Test.Tasty+import Test.Tasty.HUnit tests :: TestTree tests = testGroup "time"