# Haskell's missing mutable reference type

**URL:** <https://discourse.haskell.org/t/haskells-missing-mutable-reference-type/14248>\
**Category:** Links\
**Created:** [June 9, 2026, 9:32am UTC](https://discourse.haskell.org/t/haskells-missing-mutable-reference-type/14248 "2026-06-09T09:32:56Z")\
**Posts on this page:** 1\
**Showing post:** 39

<div class="post-metadata">

**Author:** ![prophet](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/prophet/32/5031_2.png) [@prophet](https://discourse.haskell.org/u/prophet)\
**Post date:** [June 13, 2026, 10:05pm UTC](https://discourse.haskell.org/t/haskells-missing-mutable-reference-type/14248/39 "2026-06-13T22:05:21Z")

</div>

That won’t work, at least not if you want to see intermediate results.  
The way you have it, that `f` function could do anything with its continuation, including discarding it or running it several times.

Like, what would you expect to happen if I did

```hs
> :with (\_ -> pure ()) ()
> print 5
???

```

or

```hs
> :with (\io -> io () >> io ())
> print 5
???

```

You could special case the case where you’re using it with `bracket` (which calls its continuation exactly once in a predictable way)

```hs
> :withBracket acquire release conn
> conn
Connection { hostname = "...", ... }
...
:endwith (head results)

```

but that’s not really all that different from calling `acquire` and `release` yourself.

---

_[View the full topic](https://discourse.haskell.org/t/haskells-missing-mutable-reference-type/14248)._
