Possible ghc-9.14 stream optimization bug
## Summary
I am working on updating some code (open source) to build with `ghc-9.14.1` (the release).
As part of the test suite there is a test that ensures that there are no un-evaluated thunks. That test passes with `ghc-9.12.1` and all compilers back to `ghc-9.6.7` (the earliest I have tested) but fails with `ghc-9.14.1`.
I used claude.ai to investigate this issue and come up with a fix. Part of the fix (which I am examining **VERY** closely) was the implementation of a monadic function `singletonM` and replacing a couple of instances of `Vector.singleton <$!> x` with `singletonM x`.
Claude's `singletonM` implementation is:
```
singletonM action = do
mv <- VM.unsafeNew 1
!a <- action -- bang pattern: forces 'a' to WHNF
VM.unsafeWrite mv 0 a -- writes the already-evaluated 'a' into the slot
V.unsafeFreeze mv
```
When I asked Claude for an explanation it replied:
> GHC's optimizer fuses the <\$!> (which should force the result) with the singleton construction into a single pipeline. In GHC 9.14, this fusion eliminates the forcing step — the resulting boxed array slot ends up holding a thunk pointer rather than an evaluated value, even though <$!> is supposed to force to WHNF before storing.
Would the GHC devs consider this a bug. If so, I will extract a minimal reproducer.
## Steps to reproduce
Will provide this when and if I have confirmation that this is a bug that the GHC devs think should be fixed.
## Expected behavior
I expect the optimizer in `ghc-9.14.1` to behave like the one in `ghc-9.12.1`.
## Environment
* GHC version used: 9.14.1 release
Optional:
* Operating System: Linux
* System Architecture: x86_64
issue