Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

A few stylistic tweaks in code

  • Loading branch information...
commit 0e09ba87c4c959e3b708ed4f849d6fa9cf3085e4 1 parent eb85b9b
@ozataman authored
Showing with 11 additions and 12 deletions.
  1. +1 −1  README.markdown
  2. +10 −11 src/Data/CSV/Conduit.hs
View
2  README.markdown
@@ -45,9 +45,9 @@ first.
- Ozgun Ataman (@ozataman)
- Daniel Bergey (@bergey)
- BJTerry (@BJTerry)
-- Dmitry Dzhus (@dzhus)
- Mike Craig (@mkscrg)
- Daniel Corson (@dancor)
+- Dmitry Dzhus (@dzhus)
- Niklas Hambüchen (@nh2)
View
21 src/Data/CSV/Conduit.hs
@@ -166,8 +166,9 @@ instance CSV ByteString (Row String) where
-------------------------------------------------------------------------------
fromCSVRow :: (Monad m, IsString s, CSV s r)
=> CSVSettings -> Conduit r m s
-fromCSVRow set = do
- awaitForever (\row -> mapM_ yield [rowToStr set row, "\n"] >> fromCSVRow set)
+fromCSVRow set = awaitForever $ \row -> do
+ mapM_ yield [rowToStr set row, "\n"]
+ fromCSVRow set
-------------------------------------------------------------------------------
@@ -176,11 +177,11 @@ intoCSVRow :: (MonadThrow m, AttoparsecInput i)
intoCSVRow p = parse =$= puller
where
parse = {-# SCC "conduitParser_p" #-} conduitParser p
- puller = {-# SCC "puller" #-} do
- awaitForever (\(_, mrow) ->
- case mrow of
- Just row -> yield row >> puller
- Nothing -> puller)
+ puller = {-# SCC "puller" #-}
+ awaitForever $ \ (_, mrow) ->
+ case mrow of
+ Just row -> yield row >> puller
+ Nothing -> puller
@@ -204,16 +205,14 @@ intoCSVMap set = intoCSV set =$= (headers >>= converter)
Nothing -> return []
Just [] -> headers
Just hs -> return hs
- converter hs = do
- awaitForever (\row -> yield (toMapCSV hs row) >> converter hs)
+ converter hs = awaitForever $ \row -> yield (toMapCSV hs row) >> converter hs
toMapCSV !hs !fs = M.fromList $ zip hs fs
-------------------------------------------------------------------------------
fromCSVMap :: (Monad m, IsString s, CSV s [a])
=> CSVSettings -> Conduit (M.Map k a) m s
-fromCSVMap set = do
- awaitForever (\row -> push row >> fromCSVMap set)
+fromCSVMap set = awaitForever $ \row -> push row >> fromCSVMap set
where
push r = mapM_ yield [rowToStr set (M.elems r), "\n"]
Please sign in to comment.
Something went wrong with that request. Please try again.