Skip to content

Commit fb007a8

Browse files
committed
Remove unused imports and variables
1 parent 891a077 commit fb007a8

File tree

10 files changed

+9
-86
lines changed

10 files changed

+9
-86
lines changed

servant-client-core/src/Servant/Client/Core/HasClient.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import Control.Arrow
3232
(left, (+++))
3333
import Control.Monad
3434
(unless)
35-
import qualified Data.ByteString as BS
3635
import qualified Data.ByteString.Lazy as BL
3736
import Data.Either
3837
(partitionEithers)
@@ -78,7 +77,7 @@ import Servant.API
7877
ReflectMethod (..), RemoteHost, ReqBody', SBoolI, Stream,
7978
StreamBody', Summary, ToHttpApiData, ToSourceIO (..), Vault,
8079
Verb, WithNamedContext, WithStatus (..), contentType, getHeadersHList,
81-
getResponse, toEncodedUrlPiece, toUrlPiece, NamedRoutes)
80+
getResponse, toEncodedUrlPiece, NamedRoutes)
8281
import Servant.API.Generic
8382
(GenericMode(..), ToServant, ToServantApi
8483
, GenericServant, toServant, fromServant)

servant-client/src/Servant/Client/Internal/HttpClient.hs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,12 @@ import qualified Data.ByteString as BS
4343
import Data.ByteString.Builder
4444
(toLazyByteString)
4545
import qualified Data.ByteString.Lazy as BSL
46-
import Data.Either
47-
(either)
4846
import Data.Foldable
4947
(foldl',toList)
5048
import Data.Functor.Alt
5149
(Alt (..))
5250
import Data.Maybe
53-
(maybe, maybeToList)
51+
(maybeToList)
5452
import Data.Proxy
5553
(Proxy (..))
5654
import Data.Sequence
@@ -63,7 +61,7 @@ import GHC.Generics
6361
import Network.HTTP.Media
6462
(renderHeader)
6563
import Network.HTTP.Types
66-
(hContentType, renderQuery, statusIsSuccessful, urlEncode, Status)
64+
(hContentType, statusIsSuccessful, urlEncode, Status)
6765
import Servant.Client.Core
6866

6967
import qualified Network.HTTP.Client as Client

servant-client/test/Servant/StreamSpec.hs

Lines changed: 2 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,9 @@
2121

2222
module Servant.StreamSpec (spec) where
2323

24-
import Control.Monad
25-
(when)
26-
import Control.Monad.Codensity
27-
(Codensity (..))
28-
import Control.Monad.IO.Class
29-
(MonadIO (..))
3024
import Control.Monad.Trans.Except
3125
import qualified Data.ByteString as BS
3226
import Data.Proxy
33-
import qualified Data.TDigest as TD
3427
import qualified Network.HTTP.Client as C
3528
import Prelude ()
3629
import Prelude.Compat
@@ -46,20 +39,10 @@ import System.Entropy
4639
(getEntropy, getHardwareEntropy)
4740
import System.IO.Unsafe
4841
(unsafePerformIO)
49-
import System.Mem
50-
(performGC)
5142
import Test.Hspec
5243
import Servant.ClientTestUtils (Person(..))
5344
import qualified Servant.ClientTestUtils as CT
5445

55-
#if MIN_VERSION_base(4,10,0)
56-
import GHC.Stats
57-
(gc, gcdetails_live_bytes, getRTSStats)
58-
#else
59-
import GHC.Stats
60-
(currentBytesUsed, getGCStats)
61-
#endif
62-
6346
-- This declaration simply checks that all instances are in place.
6447
-- Note: this is streaming client
6548
_ = client comprehensiveAPI
@@ -78,9 +61,9 @@ api :: Proxy StreamApi
7861
api = Proxy
7962

8063
getGetNL, getGetNS :: ClientM (SourceIO Person)
81-
getGetALot :: ClientM (SourceIO BS.ByteString)
64+
_getGetALot :: ClientM (SourceIO BS.ByteString)
8265
getStreamBody :: SourceT IO BS.ByteString -> ClientM (SourceIO BS.ByteString)
83-
getGetNL :<|> getGetNS :<|> getGetALot :<|> getStreamBody = client api
66+
getGetNL :<|> getGetNS :<|> _getGetALot :<|> getStreamBody = client api
8467

8568
alice :: Person
8669
alice = Person "Alice" 42
@@ -134,50 +117,3 @@ streamSpec = beforeAll (CT.startWaiApp server) $ afterAll CT.endWaiApp $ do
134117
where
135118
input = ["foo", "", "bar"]
136119
output = ["foo", "bar"]
137-
138-
{-
139-
it "streams in constant memory" $ \(_, baseUrl) -> do
140-
Right rs <- runClient getGetALot baseUrl
141-
performGC
142-
-- usage0 <- getUsage
143-
-- putStrLn $ "Start: " ++ show usage0
144-
tdigest <- memoryUsage $ joinCodensitySourceT rs
145-
146-
-- putStrLn $ "Median: " ++ show (TD.median tdigest)
147-
-- putStrLn $ "Mean: " ++ show (TD.mean tdigest)
148-
-- putStrLn $ "Stddev: " ++ show (TD.stddev tdigest)
149-
150-
-- forM_ [0.01, 0.1, 0.2, 0.5, 0.8, 0.9, 0.99] $ \q ->
151-
-- putStrLn $ "q" ++ show q ++ ": " ++ show (TD.quantile q tdigest)
152-
153-
let Just stddev = TD.stddev tdigest
154-
155-
-- standard deviation of 100k is ok, we generate 256M of data after all.
156-
-- On my machine deviation is 40k-50k
157-
stddev `shouldSatisfy` (< 100000)
158-
159-
memoryUsage :: SourceT IO BS.ByteString -> IO (TD.TDigest 25)
160-
memoryUsage src = unSourceT src $ loop mempty (0 :: Int)
161-
where
162-
loop !acc !_ Stop = return acc
163-
loop !_ !_ (Error err) = fail err -- !
164-
loop !acc !n (Skip s) = loop acc n s
165-
loop !acc !n (Effect ms) = ms >>= loop acc n
166-
loop !acc !n (Yield _bs s) = do
167-
usage <- liftIO getUsage
168-
-- We perform GC in between as we generate garbage.
169-
when (n `mod` 1024 == 0) $ liftIO performGC
170-
loop (TD.insert usage acc) (n + 1) s
171-
172-
getUsage :: IO Double
173-
getUsage = fromIntegral .
174-
#if MIN_VERSION_base(4,10,0)
175-
gcdetails_live_bytes . gc <$> getRTSStats
176-
#else
177-
currentBytesUsed <$> getGCStats
178-
#endif
179-
memUsed `shouldSatisfy` (< megabytes 22)
180-
181-
megabytes :: Num a => a -> a
182-
megabytes n = n * (1000 ^ (2 :: Int))
183-
-}

servant-conduit/example/Main.hs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ import Data.Maybe
1717
(fromMaybe)
1818
import Network.HTTP.Client
1919
(defaultManagerSettings, newManager)
20-
import Network.Wai
21-
(Application)
2220
import System.Environment
2321
(getArgs, lookupEnv)
2422
import Text.Read

servant-docs/src/Servant/Docs/Internal.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ import Data.String.Conversions
5555
import Data.Text
5656
(Text, unpack)
5757
import GHC.Generics
58-
(Generic, Rep, K1(K1), M1(M1), U1(U1), V1,
58+
(K1(K1), M1(M1), U1(U1), V1,
5959
(:*:)((:*:)), (:+:)(L1, R1))
6060
import qualified GHC.Generics as G
6161
import GHC.TypeLits
@@ -964,7 +964,7 @@ instance {-# OVERLAPPABLE #-}
964964

965965
instance (ReflectMethod method) =>
966966
HasDocs (NoContentVerb method) where
967-
docsFor Proxy (endpoint, action) DocOptions{..} =
967+
docsFor Proxy (endpoint, action) _ =
968968
single endpoint' action'
969969

970970
where endpoint' = endpoint & method .~ method'
@@ -982,7 +982,7 @@ instance (ReflectMethod method) =>
982982
instance {-# OVERLAPPABLE #-}
983983
(Accept ct, KnownNat status, ReflectMethod method)
984984
=> HasDocs (Stream method status framing ct a) where
985-
docsFor Proxy (endpoint, action) DocOptions{..} =
985+
docsFor Proxy (endpoint, action) _ =
986986
single endpoint' action'
987987

988988
where endpoint' = endpoint & method .~ method'

servant-machines/example/Main.hs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ import Data.Void
1717
(Void)
1818
import Network.HTTP.Client
1919
(defaultManagerSettings, newManager)
20-
import Network.Wai
21-
(Application)
2220
import System.Environment
2321
(getArgs, lookupEnv)
2422
import Text.Read

servant-pipes/example/Main.hs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ import Data.Maybe
1515
(fromMaybe)
1616
import Network.HTTP.Client
1717
(defaultManagerSettings, newManager)
18-
import Network.Wai
19-
(Application)
2018
import System.Environment
2119
(getArgs, lookupEnv)
2220
import System.IO

servant-server/src/Servant/Server/Internal.hs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,6 @@ import Servant.API.TypeErrors
9595
import Web.HttpApiData
9696
(FromHttpApiData, parseHeader, parseQueryParam, parseUrlPiece,
9797
parseUrlPieces)
98-
import Data.Kind
99-
(Type)
10098

10199
import Servant.Server.Internal.BasicAuth
102100
import Servant.Server.Internal.Context
@@ -110,7 +108,7 @@ import Servant.Server.Internal.RoutingApplication
110108
import Servant.Server.Internal.ServerError
111109

112110
import GHC.TypeLits
113-
(ErrorMessage (..), TypeError)
111+
(ErrorMessage (..))
114112
import Servant.API.TypeLevel
115113
(AtLeastOneFragment, FragmentUnique)
116114

servant-swagger/src/Servant/Swagger/Internal.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ import Network.HTTP.Media (MediaType)
3838
import Servant.API
3939
import Servant.API.Description (FoldDescription,
4040
reflectDescription)
41-
import Servant.API.Generic (ToServantApi, AsApi)
4241
import Servant.API.Modifiers (FoldRequired)
4342

4443
import Servant.Swagger.Internal.TypeLevel.API

servant/src/Servant/API/TypeErrors.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ module Servant.API.TypeErrors (
1616
NoInstanceForSub,
1717
) where
1818

19-
import Data.Kind
2019
import GHC.TypeLits
2120

2221
-- | No instance exists for @tycls (expr :> ...)@ because

0 commit comments

Comments
 (0)