Skip to content

Commit 4bb63a5

Browse files
committed
Merge branch 'main' into fix-failing-array-tests
2 parents 10484e8 + c415f1a commit 4bb63a5

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/Array/Mutable.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ set (Array lo'@(GHC.I# lo) hi !arr) i'@(GHC.I# i) !a =
117117

118118
{-# INLINE copy #-}
119119
copy :: HasPrim a => Array a -> Int -> Array a -> Int -> Int -> Array a
120-
copy s@(Array lo1'@(GHC.I# lo1) _hi1 src) (GHC.I# src_offset)
121-
d@(Array (GHC.I# lo2) _hi2 dst) (GHC.I# dst_offset)
120+
copy s@(Array (GHC.I# lo1) _hi1 src) (GHC.I# src_offset)
121+
d@(Array (GHC.I# lo2) _hi2 dst) (GHC.I# dst_offset)
122122
(GHC.I# n) =
123123
#ifdef PRIM_MUTABLE_ARRAYS
124124
case copy# (get# src lo1) src (lo1 GHC.+# src_offset) dst (lo2 GHC.+# dst_offset) n of

src/ArrayOperations.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ swap xs i j = let !xi = get xs i
5959
in xs''
6060
#endif
6161

62-
62+
-- For correctness, the strictness annotations on !xi and !xj are crucial.
63+
-- Due to laziness, there's otherwise nothing preventing `setLin i xj xs2`
64+
-- from executing before `get2 i xs`. Same with `swap` above.
6365
{-@ swap2 :: { i:Int | 0 <= i }
6466
-> { j:Int | 0 <= j } -> { xs:(Array a) | i < size xs && j < size xs }
6567
-> { ys:(Array a) | size xs == size ys && token xs == token ys &&

0 commit comments

Comments
 (0)