Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/BinomialQueue/Internals.hs
Original file line number Diff line number Diff line change
Expand Up @@ -536,8 +536,8 @@ instance Functor rk => Functor (BinomTree rk) where

instance Functor rk => Functor (BinomForest rk) where
fmap _ Nil = Nil
fmap f (Skip ts) = Skip (fmap f ts)
fmap f (Cons t ts) = Cons (fmap f t) (fmap f ts)
fmap f (Skip ts) = Skip $! fmap f ts
fmap f (Cons t ts) = Cons (fmap f t) $! fmap f ts

instance Foldr Zero where
foldr_ _ z ~Zero = z
Expand Down
10 changes: 5 additions & 5 deletions src/Data/PQueue/Internals.hs
Original file line number Diff line number Diff line change
Expand Up @@ -341,11 +341,11 @@ toListUApp (MinQueue _ x ts) app = x : BQ.foldrU (:) app ts

-- | \(O(\log n)\). @seqSpine q r@ forces the spine of @q@ and returns @r@.
--
-- Note: The spine of a 'MinQueue' is stored somewhat lazily. Most operations
-- take great care to prevent chains of thunks from accumulating along the
-- spine to the detriment of performance. However, @mapU@ can leave expensive
-- thunks in the structure and repeated applications of that function can
-- create thunk chains.
-- Note: The spine of a 'MinQueue' is stored somewhat lazily. In earlier
-- versions of this package, some operations could produce chains of thunks
-- along the spine, occasionally necessitating manual forcing. Now, all
-- operations are careful to force enough to avoid this problem.
{-# DEPRECATED seqSpine "This function is no longer necessary or useful." #-}
seqSpine :: MinQueue a -> b -> b
seqSpine Empty z = z
seqSpine (MinQueue _ _ ts) z = BQ.seqSpine ts z
Expand Down
10 changes: 5 additions & 5 deletions src/Data/PQueue/Max.hs
Original file line number Diff line number Diff line change
Expand Up @@ -369,10 +369,10 @@ keysQueue (Prio.MaxPQ q) = MaxQ (Min.keysQueue q)

-- | \(O(\log n)\). @seqSpine q r@ forces the spine of @q@ and returns @r@.
--
-- Note: The spine of a 'MaxQueue' is stored somewhat lazily. Most operations
-- take great care to prevent chains of thunks from accumulating along the
-- spine to the detriment of performance. However, 'mapU' can leave expensive
-- thunks in the structure and repeated applications of that function can
-- create thunk chains.
-- Note: The spine of a 'MaxQueue' is stored somewhat lazily. In earlier
-- versions of this package, some operations could produce chains of thunks
-- along the spine, occasionally necessitating manual forcing. Now, all
-- operations are careful to force enough to avoid this problem.
{-# DEPRECATED seqSpine "This function is no longer necessary or useful." #-}
seqSpine :: MaxQueue a -> b -> b
seqSpine (MaxQ q) = Min.seqSpine q
4 changes: 2 additions & 2 deletions src/Data/PQueue/Min.hs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ keysQueue (Prio.MinPQ n k _ ts) = MinQueue n k (BQ.MinQueue (keysF (const Zero)
keysF :: (pRk k a -> rk k) -> Prio.BinomForest pRk k a -> BinomForest rk k
keysF f ts0 = case ts0 of
Prio.Nil -> Nil
Prio.Skip ts' -> Skip (keysF f' ts')
Prio.Skip ts' -> Skip $! keysF f' ts'
Prio.Cons (Prio.BinomTree k _ ts) ts'
-> Cons (BinomTree k (f ts)) (keysF f' ts')
-> Cons (BinomTree k (f ts)) $! keysF f' ts'
where f' (Prio.Succ (Prio.BinomTree k _ ts) tss) = Succ (BinomTree k (f ts)) (f tss)
24 changes: 12 additions & 12 deletions src/Data/PQueue/Prio/Internals.hs
Original file line number Diff line number Diff line change
Expand Up @@ -615,9 +615,9 @@ extract = start
mapForest :: (k -> a -> b) -> (rk k a -> rk k b) -> BinomForest rk k a -> BinomForest rk k b
mapForest f fCh ts0 = case ts0 of
Nil -> Nil
Skip ts' -> Skip (mapForest f fCh' ts')
Skip ts' -> Skip $! mapForest f fCh' ts'
Cons (BinomTree k a ts) tss
-> Cons (BinomTree k (f k a) (fCh ts)) (mapForest f fCh' tss)
-> Cons (BinomTree k (f k a) (fCh ts)) $! mapForest f fCh' tss
where fCh' (Succ (BinomTree k a ts) tss)
= Succ (BinomTree k (f k a) (fCh ts)) (fCh tss)

Expand Down Expand Up @@ -715,12 +715,12 @@ traverseWithKeyU f (MinPQ n k a ts) = liftA2 (MinPQ n k) (f k a) (traverseForest
traverseForest :: (Applicative f) => (k -> a -> f b) -> (rk k a -> f (rk k b)) -> BinomForest rk k a -> f (BinomForest rk k b)
traverseForest f fCh ts0 = case ts0 of
Nil -> pure Nil
Skip ts' -> Skip <$> traverseForest f fCh' ts'
Skip ts' -> (Skip $!) <$> traverseForest f fCh' ts'
Cons (BinomTree k a ts) tss
-> liftA3 (\p q -> Cons (BinomTree k p q)) (f k a) (fCh ts) (traverseForest f fCh' tss)
-> liftA3 (\a' ts' tss' -> Cons (BinomTree k a' ts') $! tss') (f k a) (fCh ts) (traverseForest f fCh' tss)
where
fCh' (Succ (BinomTree k a ts) tss)
= Succ <$> (BinomTree k <$> f k a <*> fCh ts) <*> fCh tss
= liftA3 (\a' ts' -> Succ (BinomTree k a' ts')) (f k a) (fCh ts) (fCh tss)

-- | Unordered right fold on a binomial forest.
foldrWithKeyF_ :: (k -> a -> b -> b) -> (rk k a -> b -> b) -> BinomForest rk k a -> b -> b
Expand Down Expand Up @@ -748,20 +748,20 @@ foldlWithKeyF_ f fCh ts0 = case ts0 of
mapKeysMonoF :: (k -> k') -> (rk k a -> rk k' a) -> BinomForest rk k a -> BinomForest rk k' a
mapKeysMonoF f fCh ts0 = case ts0 of
Nil -> Nil
Skip ts' -> Skip (mapKeysMonoF f fCh' ts')
Skip ts' -> Skip $! mapKeysMonoF f fCh' ts'
Cons (BinomTree k a ts) ts'
-> Cons (BinomTree (f k) a (fCh ts)) (mapKeysMonoF f fCh' ts')
-> Cons (BinomTree (f k) a (fCh ts)) $! mapKeysMonoF f fCh' ts'
where
fCh' (Succ (BinomTree k a ts) tss) =
Succ (BinomTree (f k) a (fCh ts)) (fCh tss)

-- | \(O(\log n)\). @seqSpine q r@ forces the spine of @q@ and returns @r@.
--
-- Note: The spine of a 'MinPQueue' is stored somewhat lazily. Most operations
-- take great care to prevent chains of thunks from accumulating along the
-- spine to the detriment of performance. However, 'mapKeysMonotonic' can leave
-- expensive thunks in the structure and repeated applications of that function
-- can create thunk chains.
-- Note: The spine of a 'MinPQueue' is stored somewhat lazily. In earlier
-- versions of this package, some operations could produce chains of thunks
-- along the spine, occasionally necessitating manual forcing. Now, all
-- operations are careful to force enough to avoid this problem.
{-# DEPRECATED seqSpine "This function is no longer necessary or useful." #-}
seqSpine :: MinPQueue k a -> b -> b
seqSpine Empty z0 = z0
seqSpine (MinPQ _ _ _ ts0) z0 = ts0 `seqSpineF` z0 where
Expand Down
10 changes: 5 additions & 5 deletions src/Data/PQueue/Prio/Max/Internals.hs
Original file line number Diff line number Diff line change
Expand Up @@ -578,10 +578,10 @@ toListU (MaxPQ q) = fmap (first' unDown) (Q.toListU q)

-- | \(O(\log n)\). @seqSpine q r@ forces the spine of @q@ and returns @r@.
--
-- Note: The spine of a 'MaxPQueue' is stored somewhat lazily. Most operations
-- take great care to prevent chains of thunks from accumulating along the
-- spine to the detriment of performance. However, 'mapKeysMonotonic' can leave
-- expensive thunks in the structure and repeated applications of that function
-- can create thunk chains.
-- Note: The spine of a 'MaxPQueue' is stored somewhat lazily. In earlier
-- versions of this package, some operations could produce chains of thunks
-- along the spine, occasionally necessitating manual forcing. Now, all
-- operations are careful to force enough to avoid this problem.
{-# DEPRECATED seqSpine "This function is no longer necessary or useful." #-}
seqSpine :: MaxPQueue k a -> b -> b
seqSpine (MaxPQ q) = Q.seqSpine q