diff options
author | joe <joe@jerkface.net> | 2017-11-05 03:43:02 -0500 |
---|---|---|
committer | joe <joe@jerkface.net> | 2017-11-05 03:43:02 -0500 |
commit | 0658b07e68eed370c790f74db7d67f1496134b43 (patch) | |
tree | a459db44ee971c115fe4953929ebf12cf54e2287 /src/Data | |
parent | 8039d812b7ea8ae566f8873452ac34597336ddfc (diff) |
Tox: Shared secrets cache.
Diffstat (limited to 'src/Data')
-rw-r--r-- | src/Data/MinMaxPSQ.hs | 3 | ||||
-rw-r--r-- | src/Data/Wrapper/PSQ.hs | 5 |
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 () | |||
16 | empty :: MinMaxPSQ' k p v | 16 | empty :: MinMaxPSQ' k p v |
17 | empty = MinMaxPSQ PSQ.empty PSQ.empty | 17 | empty = MinMaxPSQ PSQ.empty PSQ.empty |
18 | 18 | ||
19 | singleton' :: (PSQKey k, Ord p) => k -> v -> p -> MinMaxPSQ' k p v | ||
20 | singleton' k v p = MinMaxPSQ (PSQ.singleton' k v p) (PSQ.singleton' k v (Down p)) | ||
21 | |||
19 | null :: MinMaxPSQ' k p v -> Bool | 22 | null :: MinMaxPSQ' k p v -> Bool |
20 | null (MinMaxPSQ nq xq) = PSQ.null nq | 23 | null (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 | |||
69 | singleton k p = Q.singleton k p () | 69 | singleton k p = Q.singleton k p () |
70 | {-# INLINE singleton #-} | 70 | {-# INLINE singleton #-} |
71 | 71 | ||
72 | singleton' :: (PSQKey k, Ord p) => k -> v -> p -> PSQ' k p v | ||
73 | singleton' k v p = Q.singleton k p v | ||
74 | {-# INLINE singleton' #-} | ||
75 | |||
76 | |||
72 | minView :: (PSQKey k, Ord p) => PSQ' k p v -> Maybe (Binding' k p v, PSQ' k p v) | 77 | minView :: (PSQKey k, Ord p) => PSQ' k p v -> Maybe (Binding' k p v, PSQ' k p v) |
73 | minView q = fmap (\(k,p,v,q') -> (Binding k v p, q')) $ Q.minView q | 78 | minView q = fmap (\(k,p,v,q') -> (Binding k v p, q')) $ Q.minView q |
74 | {-# INLINE minView #-} | 79 | {-# INLINE minView #-} |