# New packages effectful-postgresql and effectful-opaleye

**URL:** <https://discourse.haskell.org/t/new-packages-effectful-postgresql-and-effectful-opaleye/12457>\
**Category:** Announcements\
**Created:** [July 13, 2025, 9:45am UTC](https://discourse.haskell.org/t/new-packages-effectful-postgresql-and-effectful-opaleye/12457 "2025-07-13T09:45:40Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![fpringle](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/fpringle/32/3433_2.png) [@fpringle](https://discourse.haskell.org/u/fpringle)\
**Post date:** [July 13, 2025, 9:45am UTC](https://discourse.haskell.org/t/new-packages-effectful-postgresql-and-effectful-opaleye/12457/1 "2025-07-13T09:45:40Z")

</div>

I’ve uploaded 2 new packages candidates: [effectful-postgresql](https://hackage-content.haskell.org/package/effectful-postgresql-0.1.0.0/candidate) and [effectful-opaleye](https://hackage-content.haskell.org/package/effectful-opaleye-0.1.0.0/candidate). These integrate [postgresql-simple](https://hackage.haskell.org/package/postgresql-simple) and [opaleye](https://hackage.haskell.org/package/opaleye) with [effectful](https://hackage.haskell.org/package/effectful). I’d appreciate any feedback, especially on the effectful unlifting stuff which I’m not 100% confident about.

`effectful-postgresql` defines a simple dynamic effect [WithConnection](https://hackage-content.haskell.org/package/effectful-postgresql-0.1.0.0/candidate/docs/Effectful-PostgreSQL-Connection.html#t:WithConnection) which abstracts the idea of “give me a `postgresql-simple` [Connection](https://hackage.haskell.org/package/postgresql-simple-0.7.0.0/docs/Database-PostgreSQL-Simple.html#t:Connection), so I can do something with it”. I can think of 2 ways of interpreting this effect, both of which are implemented in the library: providing one `Connection` for the entire duration of the interpreted program (see [runWithConnection](https://hackage-content.haskell.org/package/effectful-postgresql-0.1.0.0/candidate/docs/Effectful-PostgreSQL-Connection.html#v:runWithConnection) or [runWithConnectInfo](https://hackage-content.haskell.org/package/effectful-postgresql-0.1.0.0/candidate/docs/Effectful-PostgreSQL-Connection.html#v:runWithConnectInfo)); or using a [Pool](https://hackage-content.haskell.org/package/unliftio-pool/docs/UnliftIO-Pool.html#t:Pool) of connections and only opening one when needed (see [runWithConnectionPool](https://hackage-content.haskell.org/package/effectful-postgresql-0.1.0.0/candidate/docs/Effectful-PostgreSQL-Connection-Pool.html#v:runWithConnectionPool)).

`effectful-opaleye` builds on the above by using the provided `Connection` to run type-safe PostgreSQL operations using `opaleye`.

* * *

If possible, I’d like to request feedback from people who understand `effectful`/`postgresql-simple`/`oplaye` internals well (maybe @tomjaguarpaw or @Kleidukos?). At the moment in my interpreters I’m using `localSeqUnlift(IO)` : [here](https://github.com/fpringle/effectful-postgresql/blob/404db838cc97d426210072cba5332f09bb54e622/effectful-postgresql/src/Effectful/PostgreSQL/Connection.hs#L43), [here](https://github.com/fpringle/effectful-postgresql/blob/404db838cc97d426210072cba5332f09bb54e622/effectful-postgresql/src/Effectful/PostgreSQL/Connection/Pool.hs#L27), [here](https://github.com/fpringle/effectful-postgresql/blob/404db838cc97d426210072cba5332f09bb54e622/effectful-opaleye/src/Effectful/Opaleye.hs#L98) and [here](https://github.com/fpringle/effectful-postgresql/blob/404db838cc97d426210072cba5332f09bb54e622/effectful-opaleye/src/Effectful/Opaleye.hs#L113). Does this make sense, or should I be using a different `UnliftStrategy`?

---

_[View the full topic](https://discourse.haskell.org/t/new-packages-effectful-postgresql-and-effectful-opaleye/12457)._
