on master help sign in
Streamly: FileSystem: Cleanup FileSystem directory as per hlint suggestions
b1b0ae0Sanchayan Maity
src/Streamly/FileSystem/FD.hs+4−8
@@ -1,8 +1,4 @@
1{-# LANGUAGE CPP #-}
1{-# LANGUAGE CPP #-}
2−{-# LANGUAGE BangPatterns #-}
3−{-# LANGUAGE MagicHash #-}
4−{-# LANGUAGE RecordWildCards #-}
5−{-# LANGUAGE UnboxedTuples #-}
6
2
7#include "inline.hs"
3#include "inline.hs"
8
4
@@ -204,7 +200,7 @@ stderr = Handle FD.stderr
204-- the same absolute path name and neither has been renamed, for example.
200-- the same absolute path name and neither has been renamed, for example.
205--
201--
206openFile :: FilePath -> IOMode -> IO Handle
202openFile :: 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
208
204
209-------------------------------------------------------------------------------
205-------------------------------------------------------------------------------
210-- Array IO (Input)
206-- Array IO (Input)
@@ -241,7 +237,7 @@ readArrayUpto size (Handle fd) = do
241{-# INLINABLE writeArray #-}
237{-# INLINABLE writeArray #-}
242writeArray :: Storable a => Handle -> Array a -> IO ()
238writeArray :: Storable a => Handle -> Array a -> IO ()
243writeArray _ arr | A.length arr == 0 = return ()
239writeArray _ 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 ->
245 -- RawIO.writeAll fd (castPtr p) aLen
241 -- RawIO.writeAll fd (castPtr p) aLen
246 RawIO.write fd (castPtr p) aLen
242 RawIO.write fd (castPtr p) aLen
247 {-
243 {-
@@ -349,7 +345,7 @@ read = AS.concat . readArrays
349-- @since 0.7.0
345-- @since 0.7.0
350{-# INLINE writeArrays #-}
346{-# INLINE writeArrays #-}
351writeArrays :: (MonadIO m, Storable a) => Handle -> SerialT m (Array a) -> m ()
347writeArrays :: (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)
353
349
354-- | Write a stream of arrays to a handle after coalescing them in chunks of
350-- | Write a stream of arrays to a handle after coalescing them in chunks of
355-- specified size. The chunk size is only a maximum and the actual writes could
351-- 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
369-- @since 0.7.0
365-- @since 0.7.0
370{-# INLINE writev #-}
366{-# INLINE writev #-}
371writev :: MonadIO m => Handle -> SerialT m (Array RawIO.IOVec) -> m ()
367writev :: 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)
373
369
374-- XXX this is incomplete
370-- XXX this is incomplete
375-- | Write a stream of arrays to a handle after grouping them in 'IOVec' arrays
371-- | Write a stream of arrays to a handle after grouping them in 'IOVec' arrays
src/Streamly/FileSystem/FDIO.hs−3
@@ -1,8 +1,5 @@
1{-# LANGUAGE CPP #-}
1{-# LANGUAGE CPP #-}
2{-# LANGUAGE BangPatterns #-}
2{-# LANGUAGE BangPatterns #-}
3−{-# LANGUAGE MagicHash #-}
4−{-# LANGUAGE RecordWildCards #-}
5−{-# LANGUAGE UnboxedTuples #-}
6
3
7#include "inline.hs"
4#include "inline.hs"
8
5
src/Streamly/FileSystem/Handle.hs−4
@@ -1,8 +1,4 @@
1{-# LANGUAGE CPP #-}
1{-# LANGUAGE CPP #-}
2−{-# LANGUAGE BangPatterns #-}
3−{-# LANGUAGE MagicHash #-}
4−{-# LANGUAGE RecordWildCards #-}
5−{-# LANGUAGE UnboxedTuples #-}
6
2
7#include "inline.hs"
3#include "inline.hs"
8
4