packages feed

serversession-backend-redis 1.0 → 1.0.1

raw patch · 2 files changed

+25/−5 lines, 2 filesdep +old-localedep ~taggeddep ~time

Dependencies added: old-locale

Dependency ranges changed: tagged, time

Files

serversession-backend-redis.cabal view
@@ -1,5 +1,5 @@ name:            serversession-backend-redis-version:         1.0+version:         1.0.1 license:         MIT license-file:    LICENSE author:          Felipe Lessa <felipe.lessa@gmail.com>@@ -13,6 +13,10 @@ description:     API docs and the README are available at <http://www.stackage.org/package/serversession-backend-redis> extra-source-files: README.md +flag old-locale+  description: Use time-1.4 and old-locale (GHC 7.8).+  default:     False+ library   hs-source-dirs: src   build-depends:@@ -20,17 +24,22 @@     , bytestring     , hedis                     == 0.6.*     , path-pieces-    , tagged                    >= 0.8+    , tagged                    >= 0.7     , text-    , time                      >= 1.5+    , time                      >= 1.4     , transformers     , unordered-containers      , serversession             == 1.0.*+  if flag(old-locale)+    build-depends: time == 1.4.*, old-locale+  else+    build-depends: time >= 1.5   exposed-modules:     Web.ServerSession.Backend.Redis     Web.ServerSession.Backend.Redis.Internal   extensions:+    CPP     DeriveDataTypeable     FlexibleContexts     OverloadedStrings
src/Web/ServerSession/Backend/Redis/Internal.hs view
@@ -47,6 +47,11 @@ import qualified Data.Time.Clock as TI import qualified Data.Time.Format as TI +#if MIN_VERSION_time(1,5,0)+import Data.Time.Format (defaultTimeLocale)+#else+import System.Locale (defaultTimeLocale)+#endif  ---------------------------------------------------------------------- @@ -184,13 +189,19 @@ -- | Parse 'UTCTime' from a 'ByteString' stored on Redis.  Uses -- 'error' on parse error. parseUTCTime :: ByteString -> TI.UTCTime-parseUTCTime = TI.parseTimeOrError True TI.defaultTimeLocale timeFormat . B8.unpack+#if MIN_VERSION_time(1,5,0)+parseUTCTime = TI.parseTimeOrError True defaultTimeLocale timeFormat . B8.unpack+#else+parseUTCTime =+  fromMaybe (error "Web.ServerSession.Backend.Redis.Internal.parseUTCTime") .+  TI.parseTime defaultTimeLocale timeFormat . B8.unpack+#endif   -- | Convert a 'UTCTime' into a 'ByteString' to be stored on -- Redis. printUTCTime :: TI.UTCTime -> ByteString-printUTCTime = B8.pack . TI.formatTime TI.defaultTimeLocale timeFormat+printUTCTime = B8.pack . TI.formatTime defaultTimeLocale timeFormat   -- | Time format used when storing 'UTCTime'.