diff options
Diffstat (limited to 'src/Data/Wrapper/PSQ.hs')
-rw-r--r-- | src/Data/Wrapper/PSQ.hs | 14 |
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 #-} |
4 | module Data.Wrapper.PSQ | 4 | module 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 | ||
8 | import Data.PSQueue hiding (foldr, foldl) | 8 | import Data.PSQueue hiding (foldr, foldl) |
9 | import qualified Data.PSQueue as PSQueue | 9 | import qualified Data.PSQueue as PSQueue |
10 | 10 | ||
11 | type 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. |
12 | fold' :: (Ord k, Ord p) => (k -> p -> () -> a -> a) -> a -> PSQ k p -> a | 14 | fold' :: (Ord k, Ord p) => (k -> p -> () -> a -> a) -> a -> PSQ k p -> a |
13 | fold' f a q = PSQueue.foldr f' a q | 15 | fold' 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 | ||
20 | import Data.OrdPSQ as OrdPSQ hiding (insert, map, singleton, minView) | 22 | import Data.OrdPSQ as OrdPSQ hiding (insert, map, singleton, minView) |
21 | import qualified Data.OrdPSQ as Q | 23 | import qualified Data.OrdPSQ as OrdPSQ |
22 | 24 | ||
23 | import Data.HashPSQ as HashPSQ hiding (insert, map, singleton, minView) | 25 | import Data.HashPSQ as HashPSQ hiding (insert, map, singleton, minView) |
24 | import qualified Data.HashPSQ as HashPSQ | 26 | import qualified Data.HashPSQ as Q |
25 | import Data.Hashable | 27 | import Data.Hashable |
26 | 28 | ||
27 | type PSQ k p = OrdPSQ k p () | 29 | type PSQ k p = HashPSQ k p () |
28 | type Binding k p = (k,p,()) | 30 | type Binding k p = (k,p,()) |
29 | 31 | ||
30 | type PSQKey k = (Ord k) | 32 | type PSQKey k = (Hashable k, Ord k) |
31 | 33 | ||
32 | pattern (:->) :: k -> p -> Binding k p | 34 | pattern (:->) :: k -> p -> Binding k p |
33 | pattern k :-> p <- (k,p,()) where k :-> p = (k,p,()) | 35 | pattern k :-> p <- (k,p,()) where k :-> p = (k,p,()) |