From 860e8dfd22f14ed4078f5888dfc36df0d9f39046 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone <exarkun@twistedmatrix.com> Date: Wed, 4 Sep 2019 15:08:46 -0400 Subject: [PATCH] some lint-y cleanup --- PaymentServer.cabal | 5 +++-- src/PaymentServer/Redemption.hs | 1 - src/PaymentServer/Server.hs | 3 +-- test/SpecRedemption.hs | 23 +++-------------------- 4 files changed, 7 insertions(+), 25 deletions(-) diff --git a/PaymentServer.cabal b/PaymentServer.cabal index 60a849c..56d7c01 100644 --- a/PaymentServer.cabal +++ b/PaymentServer.cabal @@ -33,11 +33,12 @@ library , containers , cryptonite default-language: Haskell2010 + ghc-options: -Wmissing-import-lists -Wunused-imports executable PaymentServer-exe hs-source-dirs: app main-is: Main.hs - ghc-options: -threaded -rtsopts -with-rtsopts=-N + ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wmissing-import-lists -Wunused-imports build-depends: base , PaymentServer default-language: Haskell2010 @@ -78,7 +79,7 @@ test-suite PaymentServer-test , containers , unordered-containers , ilist - ghc-options: -threaded -rtsopts -with-rtsopts=-N + ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wmissing-import-lists -Wunused-imports default-language: Haskell2010 source-repository head diff --git a/src/PaymentServer/Redemption.hs b/src/PaymentServer/Redemption.hs index 1d0593c..23dfbc8 100644 --- a/src/PaymentServer/Redemption.hs +++ b/src/PaymentServer/Redemption.hs @@ -25,7 +25,6 @@ import Data.Text ) import Data.Text.Encoding ( encodeUtf8 - , decodeUtf8 ) import Data.Aeson ( ToJSON(toJSON, toEncoding) diff --git a/src/PaymentServer/Server.hs b/src/PaymentServer/Server.hs index bd51423..5b7f52e 100644 --- a/src/PaymentServer/Server.hs +++ b/src/PaymentServer/Server.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE TypeOperators #-} @@ -38,4 +37,4 @@ paymentServerAPI = Proxy -- | Create a Servant Application which serves the payment server API using -- the given database. paymentServerApp :: VoucherDatabase d => d -> Application -paymentServerApp = (serve paymentServerAPI) . paymentServer +paymentServerApp = serve paymentServerAPI . paymentServer diff --git a/test/SpecRedemption.hs b/test/SpecRedemption.hs index ba4bf06..e9c0510 100644 --- a/test/SpecRedemption.hs +++ b/test/SpecRedemption.hs @@ -11,12 +11,8 @@ import Data.ByteString import Text.Printf ( printf ) -import Control.Exception - ( bracket - ) import Data.Aeson - ( FromJSON - , decode + ( decode , encode ) import Servant @@ -29,10 +25,6 @@ import Test.Hspec , parallel , describe , it - , before - , around - , shouldReturn - , shouldBe , runIO ) import Network.HTTP.Types @@ -51,13 +43,6 @@ import Test.Hspec.Wai import Test.Hspec.Wai.QuickCheck ( property ) -import Test.QuickCheck - ( Property - , (==>) - ) -import Test.QuickCheck.Monadic - ( pre - ) import Test.QuickCheck.Instances.Text () import Util.Spec ( wrongMethodNotAllowed @@ -77,9 +62,7 @@ import PaymentServer.Redemption import PaymentServer.Persistence ( RedeemError(NotPaid) , Voucher - , Fingerprint , VoucherDatabase(payForVoucher, redeemVoucher) - , MemoryVoucherDatabase , memory ) @@ -141,7 +124,7 @@ spec_redemption = parallel $ do describe "redemption" $ do - with (return . app $ RefuseRedemption NotPaid) $ do + with (return . app $ RefuseRedemption NotPaid) $ it "receives a failure response when the voucher is not paid" $ property $ \(voucher :: Voucher) (tokens :: [BlindedToken]) -> propertyRedeem path voucher tokens 400 @@ -152,7 +135,7 @@ spec_redemption = parallel $ do , matchHeaders = ["Content-Type" <:> "application/json;charset=utf-8"] } - with (return $ app PermitRedemption) $ do + with (return $ app PermitRedemption) $ it "receive a success response when redemption succeeds" $ property $ \(voucher :: Voucher) (tokens :: [BlindedToken]) -> propertyRedeem path voucher tokens 200 -- GitLab