From e06bb4c949c88283d2f3acc79e9375c7579ca8fe Mon Sep 17 00:00:00 2001 From: Aditya Manthramurthy Date: Tue, 4 Oct 2022 09:25:39 -0700 Subject: [PATCH] Enable partial fields warning (#179) - Updates exported type `EventMessage` - so avoid exporting partial functions. --- CHANGELOG.md | 4 ++++ Setup.hs | 19 ------------------- minio-hs.cabal | 8 ++++---- src/Network/Minio/Data.hs | 13 +++++++------ 4 files changed, 15 insertions(+), 29 deletions(-) delete mode 100644 Setup.hs diff --git a/CHANGELOG.md b/CHANGELOG.md index 49da420..0a747e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ Changelog ========== +## Version 1.7.0 -- Unreleased + +* Fix data type `EventMessage` to not export partial fields + ## Version 1.6.0 * HLint fixes - some types were changed to newtype (#173) diff --git a/Setup.hs b/Setup.hs deleted file mode 100644 index a3c845d..0000000 --- a/Setup.hs +++ /dev/null @@ -1,19 +0,0 @@ --- --- MinIO Haskell SDK, (C) 2017 MinIO, Inc. --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- - -import Distribution.Simple - -main = defaultMain diff --git a/minio-hs.cabal b/minio-hs.cabal index 4318367..708ba6d 100644 --- a/minio-hs.cabal +++ b/minio-hs.cabal @@ -1,4 +1,4 @@ -cabal-version: 2.2 +cabal-version: 2.4 name: minio-hs version: 1.6.0 synopsis: A MinIO Haskell Library for Amazon S3 compatible cloud @@ -44,9 +44,9 @@ common base-settings -- Add this when we have time. Fixing partial-fields requires major version -- bump at this time. - -- if impl(ghc >= 8.4) - -- ghc-options: -Wpartial-fields - -- -Wmissing-export-lists + if impl(ghc >= 8.4) + ghc-options: -Wpartial-fields + -- -Wmissing-export-lists if impl(ghc >= 8.8) ghc-options: -Wmissing-deriving-strategies diff --git a/src/Network/Minio/Data.hs b/src/Network/Minio/Data.hs index a49098e..3fcd514 100644 --- a/src/Network/Minio/Data.hs +++ b/src/Network/Minio/Data.hs @@ -963,13 +963,14 @@ outputJSONFromRecordDelimiter t = -- | An EventMessage represents each kind of message received from the server. data EventMessage - = ProgressEventMessage {emProgress :: Progress} - | StatsEventMessage {emStats :: Stats} + = ProgressEventMessage Progress + | StatsEventMessage Stats | RequestLevelErrorMessage - { emErrorCode :: Text, - emErrorMessage :: Text - } - | RecordPayloadEventMessage {emPayloadBytes :: ByteString} + Text + -- ^ Error code + Text + -- ^ Error message + | RecordPayloadEventMessage ByteString deriving stock (Show, Eq) data MsgHeaderName