Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
- type Expires = Entry UTCTime
- expiresBefore :: UTCTime -> Expires a -> Bool
- type ExpireHeap a = Heap (Expires a)
- emptyHeap :: ExpireHeap a
- fromListHeap :: [Expires a] -> ExpireHeap a
- filterHeap :: (a -> Bool) -> ExpireHeap a -> ExpireHeap a
- partitionHeap :: (a -> Bool) -> ExpireHeap a -> (ExpireHeap a, ExpireHeap a)
- nextEvent :: ExpireHeap a -> Maybe UTCTime
- dropExpired :: UTCTime -> ExpireHeap a -> ExpireHeap a
- partitionExpired :: UTCTime -> ExpireHeap a -> (ExpireHeap a, ExpireHeap a)
- expireAt :: UTCTime -> a -> ExpireHeap a -> (ExpireHeap a, UTCTime)
- nullHeap :: ExpireHeap a -> Bool
- expirationDelay :: UTCTime -> ExpireHeap a -> Maybe NominalDiffTime
- toUSeconds :: NominalDiffTime -> Int
- data Entry p a :: * -> * -> * = Entry {}
- toUnsortedList :: Heap a -> [a]
Documentation
type ExpireHeap a = Heap (Expires a) Source #
emptyHeap :: ExpireHeap a Source #
fromListHeap :: [Expires a] -> ExpireHeap a Source #
filterHeap :: (a -> Bool) -> ExpireHeap a -> ExpireHeap a Source #
partitionHeap :: (a -> Bool) -> ExpireHeap a -> (ExpireHeap a, ExpireHeap a) Source #
nextEvent :: ExpireHeap a -> Maybe UTCTime Source #
The next time that something in the heap will expire, if the heap is non-empty.
dropExpired :: UTCTime -> ExpireHeap a -> ExpireHeap a Source #
Remove all expired entries from the heap.
partitionExpired :: UTCTime -> ExpireHeap a -> (ExpireHeap a, ExpireHeap a) Source #
Given the current time, partition the heap into valid entries, and entries that have expired.
expireAt :: UTCTime -> a -> ExpireHeap a -> (ExpireHeap a, UTCTime) Source #
Add an entry to the ExpireHeap
, and return the time of the next
expiration event.
nullHeap :: ExpireHeap a -> Bool Source #
expirationDelay :: UTCTime -> ExpireHeap a -> Maybe NominalDiffTime Source #
The amount of time until the top of the heap expires, relative to the time given.
toUSeconds :: NominalDiffTime -> Int Source #
Convert a NominalDiffTime
into microseconds for use with threadDelay
.
toUnsortedList :: Heap a -> [a] #
O(n). Returns the elements in the heap in some arbitrary, very likely unsorted, order.
>>>
toUnsortedList (fromList [3,1,2])
[1,3,2]
fromList
.
toUnsortedList
≡id