forked from acowley/Frames
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBenchDemo.hs
More file actions
21 lines (19 loc) · 746 Bytes
/
BenchDemo.hs
File metadata and controls
21 lines (19 loc) · 746 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{-# LANGUAGE DataKinds, FlexibleContexts, TemplateHaskell #-}
-- | Demonstration of streaming data processing. Try building with
-- cabal (@cabal build benchdemo@), then running in bash with
-- something like,
--
-- @$ /usr/bin/time -l dist/build/benchdemo/benchdemo 2>&1 | head -n 4@
import Control.Applicative
import qualified Control.Foldl as F
import Frames
import Pipes.Prelude (fold)
tableTypes "Ins" "data/FL2.csv"
main :: IO ()
main = do (lat,lng,n) <- F.purely fold f (readTable "data/FL2.csv")
print $ lat / n
print $ lng / n
where f :: F.Fold Ins (Double,Double,Double)
f = (,,) <$> F.handles pointLatitude F.sum
<*> F.handles pointLongitude F.sum
<*> F.genericLength