summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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,())