Skip to content

Commit

Permalink
Fix deprecation warnings (#181)
Browse files Browse the repository at this point in the history
  • Loading branch information
donatello authored Oct 4, 2022
1 parent 7eef9b0 commit 0b3a555
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Changelog
## Version 1.7.0 -- Unreleased

* Fix data type `EventMessage` to not export partial fields
* Bump up min bound on time dep and fix deprecation warnings.

## Version 1.6.0

Expand Down
2 changes: 1 addition & 1 deletion minio-hs.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ common base-settings
, resourcet >= 1.2
, retry
, text >= 1.2
, time >= 1.8
, time >= 1.9
, transformers >= 0.5
, unliftio >= 0.2 && < 0.3
, unliftio-core >= 0.2 && < 0.3
Expand Down
3 changes: 2 additions & 1 deletion src/Network/Minio/Data/Time.hs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ where

import Data.ByteString.Char8 (pack)
import qualified Data.Time as Time
import Data.Time.Format.ISO8601 (iso8601Show)
import Lib.Prelude

-- | Time to expire for a presigned URL. It interpreted as a number of
Expand All @@ -49,4 +50,4 @@ awsParseTime :: [Char] -> Maybe UTCTime
awsParseTime = Time.parseTimeM False Time.defaultTimeLocale "%Y%m%dT%H%M%SZ"

iso8601TimeFormat :: UTCTime -> [Char]
iso8601TimeFormat = Time.formatTime Time.defaultTimeLocale (Time.iso8601DateFormat $ Just "%T%QZ")
iso8601TimeFormat = iso8601Show
9 changes: 3 additions & 6 deletions src/Network/Minio/XmlParser.hs
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,13 @@ import Data.List (zip4, zip6)
import qualified Data.Text as T
import Data.Text.Read (decimal)
import Data.Time
import Data.Time.Format.ISO8601 (iso8601ParseM)
import Lib.Prelude
import Network.Minio.Data
import Network.Minio.Errors
import Text.XML
import Text.XML.Cursor hiding (bool)

-- | Represent the time format string returned by S3 API calls.
s3TimeFormat :: [Char]
s3TimeFormat = iso8601DateFormat $ Just "%T%QZ"

-- | Helper functions.
uncurry4 :: (a -> b -> c -> d -> e) -> (a, b, c, d) -> e
uncurry4 f (a, b, c, d) = f a b c d
Expand All @@ -57,8 +54,8 @@ uncurry6 f (a, b, c, d, e, g) = f a b c d e g
parseS3XMLTime :: MonadIO m => Text -> m UTCTime
parseS3XMLTime t =
maybe (throwIO $ MErrVXmlParse $ "timestamp parse failure: " <> t) return $
parseTimeM True defaultTimeLocale s3TimeFormat $
T.unpack t
iso8601ParseM $
toString t

parseDecimal :: (MonadIO m, Integral a) => Text -> m a
parseDecimal numStr =
Expand Down

0 comments on commit 0b3a555

Please sign in to comment.