Skip to content
Closed
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## 1.5.0

* Deprecate `seqSpine`. Changes in version 1.4.2.0 made it useless.

* Add pattern synonyms to work with `MinQueue` and `MinPQueue`.
([#92](http://github.com/lspitzner/pqueue/pull/92))

Expand Down
7 changes: 4 additions & 3 deletions src/Data/PQueue/Internals.hs
Original file line number Diff line number Diff line change
Expand Up @@ -343,9 +343,10 @@ toListUApp (MinQueue _ x ts) app = x : BQ.foldrU (:) app ts
--
-- 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.
-- spine to the detriment of performance. The only one that doesn't,
-- 'mapU', does not benefit from forcing the spine anyway. Forcing the spine
-- of the result just forces the creation of thunks for all the elements.
{-# DEPRECATED seqSpine "This function is no longer useful." #-}
seqSpine :: MinQueue a -> b -> b
seqSpine Empty z = z
seqSpine (MinQueue _ _ ts) z = BQ.seqSpine ts z
Expand Down
7 changes: 4 additions & 3 deletions src/Data/PQueue/Max.hs
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,9 @@ keysQueue (Prio.MaxPQ q) = MaxQ (Min.keysQueue q)
--
-- 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.
-- spine to the detriment of performance. The only one that doesn't,
-- 'mapU', does not benefit from forcing the spine anyway. Forcing the spine
-- of the result just forces the creation of thunks for all the elements.
{-# DEPRECATED seqSpine "This function is no longer useful." #-}
seqSpine :: MaxQueue a -> b -> b
seqSpine (MaxQ q) = Min.seqSpine q
8 changes: 5 additions & 3 deletions src/Data/PQueue/Prio/Internals.hs
Original file line number Diff line number Diff line change
Expand Up @@ -758,9 +758,11 @@ mapKeysMonoF f fCh ts0 = case ts0 of
--
-- 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.
-- spine to the detriment of performance. The only ones that don't,
-- 'mapKeysMonotonic', 'mapWithKey', 'traverseWithKey', etc., do not benefit
-- from forcing the spine anyway. Forcing the spine just forces the creation
-- of thunks for all the elements.
{-# DEPRECATED seqSpine "This function is no longer useful." #-}
seqSpine :: MinPQueue k a -> b -> b
seqSpine Empty z0 = z0
seqSpine (MinPQ _ _ _ ts0) z0 = ts0 `seqSpineF` z0 where
Expand Down
10 changes: 6 additions & 4 deletions src/Data/PQueue/Prio/Max/Internals.hs
Original file line number Diff line number Diff line change
Expand Up @@ -577,10 +577,12 @@ 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
-- Note: The spine of a 'MinPQueue' is stored somewhat lazily. Most operations
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was correct, wasn't it?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh. Whoops.

-- 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.
-- spine to the detriment of performance. The only ones that don't,
-- 'mapKeysMonotonic', 'mapWithKey', 'traverseWithKey', etc., do not benefit
-- from forcing the spine anyway. Forcing the spine just forces the creation
-- of thunks for all the elements.
{-# DEPRECATED seqSpine "This function is no longer useful." #-}
seqSpine :: MaxPQueue k a -> b -> b
seqSpine (MaxPQ q) = Q.seqSpine q