Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
22 lines (17 sloc) 553 Bytes
module Main where
import Control.Monad (forM_)
import Data.Int (Int64)
import qualified Data.ByteString.Lazy.Char8 as LB
import System.Environment (getArgs)
import Control.Parallel.Strategies (rdeepseq)
import LineChunks (chunkedReadWith)
import MapReduce (mapReduce)
lineCount :: [LB.ByteString] -> Int64
lineCount = mapReduce rdeepseq (LB.count '\n')
rdeepseq sum
main :: IO ()
main = do
args <- getArgs
forM_ args $ \path -> do
numLines <- chunkedReadWith lineCount path
putStrLn $ path ++ ": " ++ show numLines
Something went wrong with that request. Please try again.