Skip to content

Commit 6ca2074

Browse files
comment on laziness issue
1 parent df4642e commit 6ca2074

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/ArrayOperations.hs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import Control.DeepSeq ( NFData(..) )
3636
import Language.Haskell.Liquid.ProofCombinators hiding ((?))
3737
import ProofCombinators
3838
import qualified Data.Primitive.Types as P
39+
import qualified Array as key
3940

4041
--------------------------------------------------------------------------------
4142
-- ArrayOperations contain Advanced Operations that live outside of the TCB
@@ -59,7 +60,9 @@ swap xs i j = let !xi = get xs i
5960
in xs''
6061
#endif
6162

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

0 commit comments

Comments
 (0)