packages feed

potoki-core 2.2.8.2 → 2.2.9

raw patch · 5 files changed

+25/−1 lines, 5 filesdep +time

Dependencies added: time

Files

library/Potoki/Core/Consume.hs view
@@ -100,6 +100,10 @@     rightOutput <- takeMVar rightOutputVar     return (leftOutput rightOutput) +unit :: Consume a ()+unit =+  Consume $ \ _ -> return ()+ {-# INLINABLE list #-} list :: Consume input [input] list =
library/Potoki/Core/Prelude.hs view
@@ -103,6 +103,10 @@ ------------------------- import Data.Vector as Exports (Vector) +-- time+-------------------------+import Data.Time as Exports+ -- hashable ------------------------- import Data.Hashable as Exports (Hashable)
library/Potoki/Core/Transform.hs view
@@ -44,6 +44,7 @@   count,   mapInIOWithCounter,   handleCount,+  handleCountOnInterval,   traceWithCounter, ) where
library/Potoki/Core/Transform/Basic.hs view
@@ -149,6 +149,20 @@   return a  {-|+Provides for progress monitoring by means of periodic measurement.+-}+handleCountOnInterval :: NominalDiffTime -> (Int -> IO ()) -> Transform a a+handleCountOnInterval interval handler = ioTransform $ do+  nextTime <- addUTCTime interval <$> getCurrentTime+  nextTimeRef <- newIORef nextTime+  return $ handleCount $ \ count -> do+    nextTime <- readIORef nextTimeRef+    time <- getCurrentTime+    when (time >= nextTime) $ do+      writeIORef nextTimeRef (addUTCTime interval nextTime)+      handler count++{-| Useful for debugging -} traceWithCounter :: (Int -> String) -> Transform a a
potoki-core.cabal view
@@ -1,5 +1,5 @@ name: potoki-core-version: 2.2.8.2+version: 2.2.9 synopsis: Low-level components of "potoki" description:   Provides everything required for building custom instances of@@ -58,6 +58,7 @@     scanner >=0.3 && <0.4,     stm >=2.4 && <3,     text >=1 && <2,+    time >=1.5 && <2,     transformers >=0.5 && <0.6,     unordered-containers >=0.2 && <0.3,     vector >=0.12 && <0.13