packages feed

timestamp 0.1.0.1 → 0.1.1

raw patch · 3 files changed

+37/−1 lines, 3 filesdep +foldldep ~base

Dependencies added: foldl

Dependency ranges changed: base

Files

+ library/Timestamp/Foldls.hs view
@@ -0,0 +1,30 @@+{-|+Folds on timestamped values+-}+module Timestamp.Foldl+where++import Timestamp.Prelude hiding (maximum)+import Timestamp+import Control.Foldl+++untimestamped :: Fold input output -> Fold (Timestamped input) output+untimestamped =+  premap (\ (Timestamped _ x) -> x)++filteringByUtcTime :: (UTCTime -> Bool) -> Fold (Timestamped input) output -> Fold (Timestamped input) output+filteringByUtcTime filter =+  filteringByTimestamp (filter . timestampUtcTime)++filteringByTimestamp :: (Timestamp -> Bool) -> Fold (Timestamped input) output -> Fold (Timestamped input) output+filteringByTimestamp filter =+  prefilter (\ (Timestamped ts _) -> filter ts)++inUtcTimeRange :: UTCTime -> UTCTime -> Fold (Timestamped input) output -> Fold (Timestamped input) output+inUtcTimeRange start end =+  inTimestampRange (utcTimeTimestamp start) (utcTimeTimestamp end)++inTimestampRange :: Timestamp -> Timestamp -> Fold (Timestamped input) output -> Fold (Timestamped input) output+inTimestampRange start end =+  filteringByTimestamp (\ ts -> ts >= start && ts < end)
library/Timestamp/Prelude.hs view
@@ -69,6 +69,10 @@ import Text.Read as Exports (Read(..), readMaybe, readEither) import Unsafe.Coerce as Exports +-- foldl+-------------------------+import Control.Foldl as Exports (Fold(..), FoldM(..))+ -- cereal ------------------------- import Data.Serialize as Exports (Serialize)
timestamp.cabal view
@@ -1,7 +1,7 @@ name:   timestamp version:-  0.1.0.1+  0.1.1 synopsis:   Space-efficient Unix timestamp and utilities category:@@ -40,12 +40,14 @@     Haskell2010   exposed-modules:     Timestamp+    Timestamp.Foldls   other-modules:     Timestamp.Data.Conversion     Timestamp.Data.TypesAndInstances     Timestamp.Prelude   build-depends:     cereal >=0.5.4 && <0.6,+    foldl >=1.3.5 && <2,     hashable >=1.2 && <2,     QuickCheck >=2.8.1 && <3,     time >=1.8 && <2,