Skip to content

Commit 7d747ca

Browse files
committed
Reduce warning messages from ghc.
1 parent 351587e commit 7d747ca

File tree

2 files changed

+14
-18
lines changed

2 files changed

+14
-18
lines changed

src/Codec/Archive/Zim/Parser.hs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,16 +165,16 @@ module Codec.Archive.Zim.Parser
165165
import Control.Applicative ((<$>), (<*>))
166166
import Control.Exception (Exception, throw)
167167
import Control.Monad (when)
168-
import Data.Char (chr, ord)
169-
import Data.Maybe (catMaybes, fromMaybe, fromJust)
168+
import Data.Char (chr)
169+
import Data.Maybe (fromJust)
170170
import Data.Typeable (Typeable)
171171
import qualified Data.ByteString as B
172172
import qualified Data.ByteString.Char8 as B8
173173
import qualified Data.ByteString.Lazy as BL
174-
import System.IO (Handle, IOMode(ReadMode), withBinaryFile, openBinaryFile)
174+
import System.IO (Handle, IOMode(ReadMode), withBinaryFile)
175175

176176
import Data.Conduit (($$), (=$), await, Sink)
177-
import Control.Monad.Trans.Resource (ResourceT, runResourceT)
177+
import Control.Monad.Trans.Resource (runResourceT)
178178
import Data.Conduit.Binary (sourceHandleRange, sourceLbs, sinkLbs)
179179
import Data.Conduit.Serialization.Binary (sinkGet, conduitGet)
180180
import Data.Conduit.Lzma (decompress)
@@ -260,7 +260,7 @@ data ZimDirEnt = ZimDirEnt
260260
-- can be opened with the same ZIM header in order to call
261261
-- functions in parallel.
262262
-- If the underlying ZIM file has changed, a new ZIM header should be parsed.
263-
getZimHeader :: Handle -- ^ Handle to ZIM file (eg. previously returned from 'openBinaryFile' or 'withBinaryFile')
263+
getZimHeader :: Handle -- ^ Handle to ZIM file (eg. previously returned from 'withBinaryFile')
264264
-> IO ZimHeader -- ^ Returns ZIM Header
265265
getZimHeader hdl = src $$ sinkGet parseZimHeader
266266
where (pos, len) = (Just 0, Just 80)

test/Codec/Archive/Zim/ParserSpec.hs

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@
22
module Codec.Archive.Zim.ParserSpec (main, spec) where
33

44
import Control.Monad (forM_)
5-
import qualified Data.ByteString as B
65
import qualified Data.ByteString.Char8 as B8
76
import qualified Data.ByteString.Lazy as BL
8-
import qualified Data.ByteString.Lazy.Char8 as BL8
9-
import Data.Char (ord)
107
import Data.Maybe (fromJust, isJust)
118
import System.IO (Handle, openBinaryFile, IOMode(ReadMode))
129

@@ -16,6 +13,7 @@ import Test.Hspec
1613

1714
import Codec.Archive.Zim.Parser
1815

16+
testSmallFilePath :: FilePath
1917
testSmallFilePath = "test/wikipedia_en_ray_charles_2015-06.zim"
2018

2119
main :: IO ()
@@ -32,27 +30,27 @@ spec = do
3230
describe "zim" $ do
3331
beforeAll setup $ do
3432

35-
it "can open Ray Charles ZIM" $ \(smallZim, small) -> do
33+
it "can open Ray Charles ZIM" $ \(smallZim, _) -> do
3634
zimMagicNumber smallZim `shouldBe` 72173914
3735

38-
it "can get version" $ \(smallZim, small) -> do
36+
it "can get version" $ \(smallZim, _) -> do
3937
zimVersion smallZim `shouldBe` 5
4038

41-
it "can get article count" $ \(smallZim, small) -> do
39+
it "can get article count" $ \(smallZim, _) -> do
4240
zimArticleCount smallZim `shouldBe` 458
4341

44-
it "can get cluster count" $ \(smallZim, small) -> do
42+
it "can get cluster count" $ \(smallZim, _) -> do
4543
zimClusterCount smallZim `shouldBe` 215
4644

4745
it "can parse MIME list" $ \(smallZim, small) -> do
4846
mimeList <- getZimMimeList smallZim small
4947
mimeList ! 0 `shouldBe` "application/javascript"
5048
bounds mimeList `shouldBe` (0, 9)
5149

52-
it "can get main page" $ \(smallZim, small) -> do
50+
it "can get main page" $ \(smallZim, _) -> do
5351
zimMainPage smallZim `shouldBe` Just 238
5452

55-
it "can get main page URL" $ \(smallZim, small) -> do
53+
it "can get main page URL" $ \_ -> do
5654
url <- getZimMainPageUrl testSmallFilePath
5755
url `shouldBe` Just "A/index.htm"
5856

@@ -62,8 +60,6 @@ spec = do
6260
zimDeUrl de `shouldBe` "favicon"
6361

6462
it "can lookup directory entry by Title index" $ \(smallZim, small) -> do
65-
de <- getZimDirEntByTitleIndex smallZim small 4
66-
zimDeTitle de `shouldBe` "A Fool for You"
6763
de <- getZimDirEntByTitleIndex smallZim small 3
6864
zimDeTitle de `shouldBe` "(The Night Time Is) The Right Time"
6965
zimDeNamespace de `shouldBe` 'A'
@@ -128,7 +124,7 @@ spec = do
128124
res <- searchZimDirEntByUrl smallZim small url
129125
res `shouldBe` Nothing
130126

131-
it "can get (mimetype, content)" $ \(smallZim, small) -> do
127+
it "can get (mimetype, content)" $ \_ -> do
132128
res <- getZimUrlContent testSmallFilePath "A/index.htm"
133129
res `shouldSatisfy` isJust
134130
let Just (m, c) = res
@@ -148,7 +144,7 @@ spec = do
148144
de <- getZimDirEntByUrlIndex hdr hdl i
149145
let url = zimDeUrl de
150146
bs <- getZimContentByUrlIndex hdr hdl i
151-
(url, bs) `shouldSatisfy` (\(u, b) -> BL.length b > 0)
147+
(url, bs) `shouldSatisfy` (\(_, b) -> BL.length b > 0)
152148

153149
it "can search all URLs" $ \(smallZim, small) -> do
154150
deList <- mapM (getZimDirEntByUrlIndex smallZim small) [0 .. zimArticleCount smallZim - 1]

0 commit comments

Comments
 (0)