Skip to content

Commit

Permalink
Fix strictness bugs in fromDistinctAscList and fromDistinctDescList
Browse files Browse the repository at this point in the history
  • Loading branch information
neilmayhew committed Mar 28, 2024
1 parent 0068399 commit 15c6092
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions containers/src/Data/Map/Strict/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1762,7 +1762,7 @@ fromDistinctAscList = fromDistinctAscList_linkAll . Foldable.foldl' next (State0
where
next :: FromDistinctMonoState k a -> (k,a) -> FromDistinctMonoState k a
next (State0 stk) (!kx, !x) = fromDistinctAscList_linkTop (Bin 1 kx x Tip Tip) stk
next (State1 l stk) (kx, x) = State0 (Push kx x l stk)
next (State1 l stk) (!kx, !x) = State0 (Push kx x l stk)
{-# INLINE fromDistinctAscList #-} -- INLINE for fusion

-- | \(O(n)\). Build a map from a descending list of distinct elements in linear time.
Expand All @@ -1781,5 +1781,5 @@ fromDistinctDescList = fromDistinctDescList_linkAll . Foldable.foldl' next (Stat
where
next :: FromDistinctMonoState k a -> (k,a) -> FromDistinctMonoState k a
next (State0 stk) (!kx, !x) = fromDistinctDescList_linkTop (Bin 1 kx x Tip Tip) stk
next (State1 r stk) (kx, x) = State0 (Push kx x r stk)
next (State1 r stk) (!kx, !x) = State0 (Push kx x r stk)
{-# INLINE fromDistinctDescList #-} -- INLINE for fusion

0 comments on commit 15c6092

Please sign in to comment.