Created
July 5, 2017 22:14
-
-
Save atondwal/8754e49433920ab1365d1470407088c9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE ScopedTypeVariables #-} | |
import qualified Data.ByteString.Lazy as BL | |
import Data.Csv | |
import qualified Data.Vector as V | |
import Control.Arrow | |
import Data.List | |
import Data.Function | |
combine :: [(String,Int)] -> [(String, Int)] | |
combine = map ((fst . head) &&& (sum . map snd)) . groupBy ((==) `on` fst) . sort | |
main :: IO () | |
main = do | |
csvData <- BL.readFile "/home/atondwal/src/lh-prover/popl18/z3pbe.csv" | |
case decode NoHeader csvData of | |
Left err -> putStrLn err | |
Right v -> BL.putStr $ encode $ combine $ V.toList v |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment