summaryrefslogtreecommitdiff
path: root/src/Data/Wrapper
diff options
context:
space:
mode:
Diffstat (limited to 'src/Data/Wrapper')
-rw-r--r--src/Data/Wrapper/PSQ.hs13
-rw-r--r--src/Data/Wrapper/PSQInt.hs6
2 files changed, 13 insertions, 6 deletions
diff --git a/src/Data/Wrapper/PSQ.hs b/src/Data/Wrapper/PSQ.hs
index 5d32e16c..745e556b 100644
--- a/src/Data/Wrapper/PSQ.hs
+++ b/src/Data/Wrapper/PSQ.hs
@@ -22,9 +22,11 @@ fold' f a q = PSQueue.foldr f' a q
22-- import Data.OrdPSQ as OrdPSQ hiding (insert, map, singleton, minView) 22-- import Data.OrdPSQ as OrdPSQ hiding (insert, map, singleton, minView)
23-- import qualified Data.OrdPSQ as OrdPSQ 23-- import qualified Data.OrdPSQ as OrdPSQ
24 24
25import Data.HashPSQ as HashPSQ hiding (insert, map, singleton, minView)
26import qualified Data.HashPSQ as Q
27import Data.Hashable 25import Data.Hashable
26import qualified Data.HashPSQ as Q
27 ;import Data.HashPSQ as HashPSQ hiding (insert, map, minView,
28 singleton)
29import Data.Time.Clock.POSIX (POSIXTime)
28 30
29type PSQ' k p v = HashPSQ k p v 31type PSQ' k p v = HashPSQ k p v
30type PSQ k p = PSQ' k p () 32type PSQ k p = PSQ' k p ()
@@ -78,4 +80,11 @@ minView :: (PSQKey k, Ord p) => PSQ' k p v -> Maybe (Binding' k p v, PSQ' k p v)
78minView q = fmap (\(k,p,v,q') -> (Binding k v p, q')) $ Q.minView q 80minView q = fmap (\(k,p,v,q') -> (Binding k v p, q')) $ Q.minView q
79{-# INLINE minView #-} 81{-# INLINE minView #-}
80 82
83
84-- | Utility to convert a 'POSIXTime' delta into microseconds suitable for
85-- passing to 'threadDelay'.
86toMicroseconds :: POSIXTime -> Int
87toMicroseconds = round . (* 1000) . (* 1000)
88
89
81#endif 90#endif
diff --git a/src/Data/Wrapper/PSQInt.hs b/src/Data/Wrapper/PSQInt.hs
index c61b7ab6..5badb8b2 100644
--- a/src/Data/Wrapper/PSQInt.hs
+++ b/src/Data/Wrapper/PSQInt.hs
@@ -19,12 +19,10 @@ fold' f a q = PSQueue.foldr f' a q
19#else 19#else
20 ( module Data.Wrapper.PSQInt 20 ( module Data.Wrapper.PSQInt
21 , module IntPSQ 21 , module IntPSQ
22 , pattern (:->) 22 , module Data.Wrapper.PSQ
23 , key
24 , prio
25 ) where 23 ) where
26 24
27import Data.Wrapper.PSQ (Binding, pattern (:->), key, prio) 25import Data.Wrapper.PSQ (Binding, pattern (:->), key, prio, toMicroseconds)
28 26
29import Data.IntPSQ as IntPSQ hiding (insert, map, singleton, minView) 27import Data.IntPSQ as IntPSQ hiding (insert, map, singleton, minView)
30import qualified Data.IntPSQ as Q 28import qualified Data.IntPSQ as Q