summaryrefslogtreecommitdiff
path: root/src/Data/Wrapper
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2017-07-19 20:31:23 -0400
committerjoe <joe@jerkface.net>2017-07-19 20:31:23 -0400
commit5c9180fa337dc2b87606d573ca3ec044554fa7d0 (patch)
tree63d48608d4aa1b0f8b3a41bdbe12d17b381d201b /src/Data/Wrapper
parentcb597a007f4e067d8eb1d85850daff721b3c66e4 (diff)
Switch Wrapper.PSQ from OrdPSQ to HashablePSQ.
Diffstat (limited to 'src/Data/Wrapper')
-rw-r--r--src/Data/Wrapper/PSQ.hs14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/Data/Wrapper/PSQ.hs b/src/Data/Wrapper/PSQ.hs
index 7e14008b..54365a1d 100644
--- a/src/Data/Wrapper/PSQ.hs
+++ b/src/Data/Wrapper/PSQ.hs
@@ -3,11 +3,13 @@
3{-# LANGUAGE ConstraintKinds #-} 3{-# LANGUAGE ConstraintKinds #-}
4module Data.Wrapper.PSQ 4module Data.Wrapper.PSQ
5#if 0 5#if 0
6 ( module Data.PSQueue ) where 6 ( module Data.Wrapper.PSQ , module Data.PSQueue ) where
7 7
8import Data.PSQueue hiding (foldr, foldl) 8import Data.PSQueue hiding (foldr, foldl)
9import qualified Data.PSQueue as PSQueue 9import qualified Data.PSQueue as PSQueue
10 10
11type PSQKey k = (Ord k)
12
11-- | Wrapper over PSQueue-style foldr to implement a psqueues-style interface. 13-- | Wrapper over PSQueue-style foldr to implement a psqueues-style interface.
12fold' :: (Ord k, Ord p) => (k -> p -> () -> a -> a) -> a -> PSQ k p -> a 14fold' :: (Ord k, Ord p) => (k -> p -> () -> a -> a) -> a -> PSQ k p -> a
13fold' f a q = PSQueue.foldr f' a q 15fold' f a q = PSQueue.foldr f' a q
@@ -15,19 +17,19 @@ fold' f a q = PSQueue.foldr f' a q
15 f' (k :-> prio) x = f k prio () x 17 f' (k :-> prio) x = f k prio () x
16 18
17#else 19#else
18 ( module Data.Wrapper.PSQ , module OrdPSQ ) where 20 ( module Data.Wrapper.PSQ , module HashPSQ ) where
19 21
20import Data.OrdPSQ as OrdPSQ hiding (insert, map, singleton, minView) 22import Data.OrdPSQ as OrdPSQ hiding (insert, map, singleton, minView)
21import qualified Data.OrdPSQ as Q 23import qualified Data.OrdPSQ as OrdPSQ
22 24
23import Data.HashPSQ as HashPSQ hiding (insert, map, singleton, minView) 25import Data.HashPSQ as HashPSQ hiding (insert, map, singleton, minView)
24import qualified Data.HashPSQ as HashPSQ 26import qualified Data.HashPSQ as Q
25import Data.Hashable 27import Data.Hashable
26 28
27type PSQ k p = OrdPSQ k p () 29type PSQ k p = HashPSQ k p ()
28type Binding k p = (k,p,()) 30type Binding k p = (k,p,())
29 31
30type PSQKey k = (Ord k) 32type PSQKey k = (Hashable k, Ord k)
31 33
32pattern (:->) :: k -> p -> Binding k p 34pattern (:->) :: k -> p -> Binding k p
33pattern k :-> p <- (k,p,()) where k :-> p = (k,p,()) 35pattern k :-> p <- (k,p,()) where k :-> p = (k,p,())