summaryrefslogtreecommitdiff
path: root/src/Index.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Index.hs')
-rw-r--r--src/Index.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Index.hs b/src/Index.hs
index bdc3751..89a24e3 100644
--- a/src/Index.hs
+++ b/src/Index.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE NumericUnderscores #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ViewPatterns #-}
@@ -95,14 +96,15 @@ initIndex basedir toimport = do
Nothing -> error $ "Log file with unexpected file name: " ++ path
-- atomicPrintS $ "Parsing " ++ path ++ " (" ++ show date ++ " -> " ++ show (dateToDay date) ++ ")"
events <- parseLog <$> BS.readFile path
- return (uncurry3 fromGregorian date, length events)
+ let !nevents = length events
+ return (uncurry3 fromGregorian date, nevents)
let minday = minimum (map fst days)
maxday = maximum (map fst days)
ndays = fromIntegral @Integer @Int (diffDays maxday minday + 1)
-- traceM $ nw ++ "/" ++ ch ++ ": days = " ++ show [(toFileName (dayToYMD d), i) | (d, i) <- days]
let countScan = IGV.fromListN ndays (drop 1 $ scanl' (+) 0 (makeCounts [minday..maxday] days))
ntotal = sum (map snd days)
- chanindex <- newIORef $
+ chanindex <- newIORef $!
ChanIndex { ciStartDay = minday
, ciCountUntil = countScan
, ciTotal = ntotal }