:sprint in GHCi yields surprising results on BCOs linked as a group
Summary
When two bindings are defined in the same binding group their thunks will not update correctly.
Steps to reproduce
GHCi, version 9.6.2: https://www.haskell.org/ghc/ :? for help
ghci> :{
ghci| y = 1 + 2 + 3 :: Int
ghci| x = (y, y)
ghci| :}
ghci> :force y
y = 6
ghci> :sprint x
x = _
Notes:
-
:forceis not necessary, forcingyby printing it also does not updatex. -
;instead of the multiline:{:}block also exhibits the same bad behaviour. -
Loading the
xandybindings from a file exhibits the same issue. -
You could argue that
xitself simply hasn't evaluated the outer(,)constructor yet, but that doesn't explain this:ghci> x = 1 + 2 :: Int; y = [x, x] ghci> length y 2 ghci> :force x x = 3 ghci> :sprint y y = [_,_] -
performMajorGCdoes not change anything.
Expected behavior
It should behave the same as two separate bindings:
ghci> y = 1 + 2 + 3 :: Int
ghci> x = (y, y)
ghci> :force y
y = 6
ghci> :sprint x
x = (6,6)
Environment
- GHC version used: 9.6.2