Skip to content

Commit fa44d80

Browse files
jazulloulysses4ever
authored andcommitted
Use alloc proposal in parallel mergesort
Also, remove typeclass constraint on `free` since it is unnecessary and enables typechecking
1 parent ec278d2 commit fa44d80

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/Array.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ makeArray = make
9999
#endif
100100

101101
{-# INLINE free #-}
102-
free :: HasPrim a => Array a -. ()
102+
free :: Array a -. ()
103103
free = Unsafe.toLinear (\_ -> ())
104104

105105
{-# INLINE flattenCallback #-}

src/DpsMergeSort4Par.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ msort' :: (Show a, HasPrimOrd a) =>
107107
a -> A.Array a -. A.Array a
108108
msort' anyVal src =
109109
let !(Ur len, src') = A.size2 src
110-
!(src'', _tmp) = msortInplace src' (A.make len anyVal) in
111-
case A.free _tmp of !() -> src''
110+
!src'' = A.allocScratch len anyVal msortInplace src' in
111+
src''
112112
{-# INLINE msort' #-}
113113

114114
-- finally, the top-level merge sort function

0 commit comments

Comments
 (0)