summaryrefslogtreecommitdiff
path: root/src/Data
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2017-11-05 03:43:02 -0500
committerjoe <joe@jerkface.net>2017-11-05 03:43:02 -0500
commit0658b07e68eed370c790f74db7d67f1496134b43 (patch)
treea459db44ee971c115fe4953929ebf12cf54e2287 /src/Data
parent8039d812b7ea8ae566f8873452ac34597336ddfc (diff)
Tox: Shared secrets cache.
Diffstat (limited to 'src/Data')
-rw-r--r--src/Data/MinMaxPSQ.hs3
-rw-r--r--src/Data/Wrapper/PSQ.hs5
2 files changed, 8 insertions, 0 deletions
diff --git a/src/Data/MinMaxPSQ.hs b/src/Data/MinMaxPSQ.hs
index 2b3b17b5..3b9a4d6c 100644
--- a/src/Data/MinMaxPSQ.hs
+++ b/src/Data/MinMaxPSQ.hs
@@ -16,6 +16,9 @@ type MinMaxPSQ k p = MinMaxPSQ' k p ()
16empty :: MinMaxPSQ' k p v 16empty :: MinMaxPSQ' k p v
17empty = MinMaxPSQ PSQ.empty PSQ.empty 17empty = MinMaxPSQ PSQ.empty PSQ.empty
18 18
19singleton' :: (PSQKey k, Ord p) => k -> v -> p -> MinMaxPSQ' k p v
20singleton' k v p = MinMaxPSQ (PSQ.singleton' k v p) (PSQ.singleton' k v (Down p))
21
19null :: MinMaxPSQ' k p v -> Bool 22null :: MinMaxPSQ' k p v -> Bool
20null (MinMaxPSQ nq xq) = PSQ.null nq 23null (MinMaxPSQ nq xq) = PSQ.null nq
21 24
diff --git a/src/Data/Wrapper/PSQ.hs b/src/Data/Wrapper/PSQ.hs
index 58a6f624..631af6ec 100644
--- a/src/Data/Wrapper/PSQ.hs
+++ b/src/Data/Wrapper/PSQ.hs
@@ -69,6 +69,11 @@ singleton :: (PSQKey k, Ord p) => k -> p -> PSQ k p
69singleton k p = Q.singleton k p () 69singleton k p = Q.singleton k p ()
70{-# INLINE singleton #-} 70{-# INLINE singleton #-}
71 71
72singleton' :: (PSQKey k, Ord p) => k -> v -> p -> PSQ' k p v
73singleton' k v p = Q.singleton k p v
74{-# INLINE singleton' #-}
75
76
72minView :: (PSQKey k, Ord p) => PSQ' k p v -> Maybe (Binding' k p v, PSQ' k p v) 77minView :: (PSQKey k, Ord p) => PSQ' k p v -> Maybe (Binding' k p v, PSQ' k p v)
73minView q = fmap (\(k,p,v,q') -> (Binding k v p, q')) $ Q.minView q 78minView q = fmap (\(k,p,v,q') -> (Binding k v p, q')) $ Q.minView q
74{-# INLINE minView #-} 79{-# INLINE minView #-}