Skip to content

Commit 74a4041

Browse files
Update shadowing warnings.
1 parent b094dff commit 74a4041

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

Database/MongoDB/GridFS.hs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,10 @@ finalizeFile :: (Monad m, MonadIO m) => Text -> FileWriter -> Action m File
136136
finalizeFile filename (FileWriter chunkSize bucket files_id i size acc md5context md5acc) = do
137137
let md5digest = finalizeMD5 md5context (L.toStrict md5acc)
138138
when (L.length acc > 0) $ putChunk bucket files_id i acc
139-
timestamp <- liftIO $ getCurrentTime
139+
currentTimestamp <- liftIO $ getCurrentTime
140140
let doc = [ "_id" =: files_id
141141
, "length" =: size
142-
, "uploadDate" =: timestamp
142+
, "uploadDate" =: currentTimestamp
143143
, "md5" =: show (md5digest)
144144
, "chunkSize" =: chunkSize
145145
, "filename" =: filename
@@ -149,13 +149,13 @@ finalizeFile filename (FileWriter chunkSize bucket files_id i size acc md5contex
149149

150150
-- finalize the remainder and return the MD5Digest.
151151
finalizeMD5 :: MD5Context -> S.ByteString -> MD5Digest
152-
finalizeMD5 ctx rest =
153-
md5Finalize ctx2 (S.drop lu rest) -- can only handle max md5BlockSizeInBytes length
152+
finalizeMD5 ctx remainder =
153+
md5Finalize ctx2 (S.drop lu remainder) -- can only handle max md5BlockSizeInBytes length
154154
where
155-
l = S.length rest
155+
l = S.length remainder
156156
r = l `mod` md5BlockSizeInBytes
157157
lu = l - r
158-
ctx2 = md5Update ctx (S.take lu rest)
158+
ctx2 = md5Update ctx (S.take lu remainder)
159159

160160
-- Write as many chunks as can be written from the file writer
161161
writeChunks :: (Monad m, MonadIO m) => FileWriter -> L.ByteString -> Action m FileWriter
@@ -167,16 +167,16 @@ writeChunks (FileWriter chunkSize bucket files_id i size acc md5context md5acc)
167167
if (L.length md5acc_temp < md5BlockLength)
168168
then (md5context, md5acc_temp)
169169
else let numBlocks = L.length md5acc_temp `div` md5BlockLength
170-
(current, rest) = L.splitAt (md5BlockLength * numBlocks) md5acc_temp
171-
in (md5Update md5context (L.toStrict current), rest)
170+
(current, remainder) = L.splitAt (md5BlockLength * numBlocks) md5acc_temp
171+
in (md5Update md5context (L.toStrict current), remainder)
172172
-- Update chunks
173173
let size' = (size + L.length chunk)
174174
let acc_temp = (acc `L.append` chunk)
175175
if (L.length acc_temp < chunkSize)
176176
then return (FileWriter chunkSize bucket files_id i size' acc_temp md5context' md5acc')
177177
else do
178-
let (chunk, acc') = L.splitAt chunkSize acc_temp
179-
putChunk bucket files_id i chunk
178+
let (newChunk, acc') = L.splitAt chunkSize acc_temp
179+
putChunk bucket files_id i newChunk
180180
writeChunks (FileWriter chunkSize bucket files_id (i+1) size' acc' md5context' md5acc') L.empty
181181

182182
sinkFile :: (Monad m, MonadIO m) => Bucket -> Text -> ConduitT S.ByteString o (Action m) File

0 commit comments

Comments
 (0)