on master help sign in
Streamly: FileSystem: Cleanup FileSystem directory as per hlint suggestions

Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>

commitb1b0ae0ce7b2ac301fea2800d133cb172c0658bc authorSanchayan Maity <maitysanchayan@gmail.com> dateFri 14 Feb 2020, 16:09 (7 years ago) parentdc7aad1
3 files changed+4−15
src/Streamly/FileSystem/FD.hs+4−8 src/Streamly/FileSystem/FDIO.hs−3 src/Streamly/FileSystem/Handle.hs−4
src/Streamly/FileSystem/FD.hs+4−8
@@ -1,8 +1,4 @@
11{-# LANGUAGE CPP #-}
2−{-# LANGUAGE BangPatterns #-}
3−{-# LANGUAGE MagicHash #-}
4−{-# LANGUAGE RecordWildCards #-}
5−{-# LANGUAGE UnboxedTuples #-}
62
73#include "inline.hs"
84
@@ -204,7 +200,7 @@ stderr = Handle FD.stderr
204200-- the same absolute path name and neither has been renamed, for example.
205201--
206202openFile :: FilePath -> IOMode -> IO Handle
207−openFile path mode = fmap (Handle . fst) $ FD.openFile path mode True
203+openFile path mode = Handle . fst <$> FD.openFile path mode True
208204
209205-------------------------------------------------------------------------------
210206-- Array IO (Input)
@@ -241,7 +237,7 @@ readArrayUpto size (Handle fd) = do
241237{-# INLINABLE writeArray #-}
242238writeArray :: Storable a => Handle -> Array a -> IO ()
243239writeArray _ arr | A.length arr == 0 = return ()
244−writeArray (Handle fd) arr = withForeignPtr (aStart arr) $ \p -> do
240+writeArray (Handle fd) arr = withForeignPtr (aStart arr) $ \p ->
245241 -- RawIO.writeAll fd (castPtr p) aLen
246242 RawIO.write fd (castPtr p) aLen
247243 {-
@@ -349,7 +345,7 @@ read = AS.concat . readArrays
349345-- @since 0.7.0
350346{-# INLINE writeArrays #-}
351347writeArrays :: (MonadIO m, Storable a) => Handle -> SerialT m (Array a) -> m ()
352−writeArrays h m = S.mapM_ (liftIO . writeArray h) m
348+writeArrays h = S.mapM_ (liftIO . writeArray h)
353349
354350-- | Write a stream of arrays to a handle after coalescing them in chunks of
355351-- specified size. The chunk size is only a maximum and the actual writes could
@@ -369,7 +365,7 @@ writeArraysPackedUpto n h xs = writeArrays h $ AS.compact n xs
369365-- @since 0.7.0
370366{-# INLINE writev #-}
371367writev :: MonadIO m => Handle -> SerialT m (Array RawIO.IOVec) -> m ()
372−writev h m = S.mapM_ (liftIO . writeIOVec h) m
368+writev h = S.mapM_ (liftIO . writeIOVec h)
373369
374370-- XXX this is incomplete
375371-- | Write a stream of arrays to a handle after grouping them in 'IOVec' arrays
src/Streamly/FileSystem/FDIO.hs−3
@@ -1,8 +1,5 @@
11{-# LANGUAGE CPP #-}
22{-# LANGUAGE BangPatterns #-}
3−{-# LANGUAGE MagicHash #-}
4−{-# LANGUAGE RecordWildCards #-}
5−{-# LANGUAGE UnboxedTuples #-}
63
74#include "inline.hs"
85
src/Streamly/FileSystem/Handle.hs−4
@@ -1,8 +1,4 @@
11{-# LANGUAGE CPP #-}
2−{-# LANGUAGE BangPatterns #-}
3−{-# LANGUAGE MagicHash #-}
4−{-# LANGUAGE RecordWildCards #-}
5−{-# LANGUAGE UnboxedTuples #-}
62
73#include "inline.hs"
84