File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -117,8 +117,8 @@ set (Array lo'@(GHC.I# lo) hi !arr) i'@(GHC.I# i) !a =
117117
118118{-# INLINE copy #-}
119119copy :: 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
Original file line number Diff line number Diff 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 &&
You can’t perform that action at this time.
0 commit comments