bluefin-opaleye: bluefin support for high-level PostgreSQL operations via Opaleye.

[ bsd3, database, library ] [ Propose Tags ] [ Report a vulnerability ]

See the README for an overview, or the documentation in Bluefin.Opaleye.


[Skip to Readme]

Modules

  • Bluefin
    • Bluefin.Opaleye
      • Bluefin.Opaleye.Count
      • Bluefin.Opaleye.Effect

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1.0.0
Change log CHANGELOG.md
Dependencies base (>=4 && <5), bluefin (>=0.0.11 && <0.0.18), bluefin-postgresql (>=0.1 && <0.2), containers (>=0.6 && <0.8), opaleye (>=0.9 && <0.11), postgresql-simple (>=0.7 && <0.8), pretty (>=1.1.1.0 && <1.2), product-profunctors (>=0.9 && <0.12), text (>=2.0 && <2.2) [details]
Tested with ghc ==8.10.7, ghc ==9.0.2, ghc ==9.2.4, ghc ==9.2.8, ghc ==9.4.2, ghc ==9.4.5, ghc ==9.6.1, ghc ==9.6.7, ghc ==9.8.2, ghc ==9.10.2
License BSD-3-Clause
Copyright Copyright(c) Frederick Pringle 2025
Author Frederick Pringle
Maintainer frederick.pringle@fpringle.com
Uploaded by fpringle at 2026-02-27T10:24:18Z
Category Database
Home page https://github.com/fpringle/bluefin-postgresql
Distributions
Downloads 0 total (0 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2026-02-27 [all 2 reports]

Readme for bluefin-opaleye-0.1.0.0

[back to package description]

bluefin-opaleye

This package provides a bluefin effect for Opaleye operations.

It combines the very safe, high-level syntax of Opaleye, with the WithConnection abstraction of bluefin-postgresql.

Effectful functions

In the Opaleye effect we can perform the 4 main operations permitted by Opaleye: query, insert, delete, and update.

{-# LANGUAGE Arrows #-}
import Control.Arrow
import Bluefin.Opaleye as BO
import qualified Opaleye as O

insertAndList :: (e :> es) => Opaleye e -> Eff es [User]
insertAndList o = do
  BO.runInsert o $ O.Insert userTable [User {firstName = "Nuala"}] O.rCount Nothing

  BO.runDelete o $ O.Delete userTable isAdmin O.rCount

  BO.runUpdate o $ O.Update userTable (\user -> user {updatedAt = O.now}) isAdmin O.rCount

  BO.runSelect o $ proc () -> do
    user <- O.selectTable userTable -< ()
    O.restrict -< firstName user `O.in_` (O.toFields <$> ["Anna", "Boris", "Carla"])
    returnA -< user

Interpreters

To run the Opaleye effect we can use the WithConnection effect from bluefin-postgresql:

import Bluefin.Opaleye as BO

doOpaleyeStuff :: (e :> es) => WithConnection e -> IOE e -> Eff es [User]
doOpaleyeStuff wc ioe =
  BO.runOpaleyeWithConnection wc ioe $ \o -> insertAndList o

The WithConnection effect can then be dispatched using one of its interpreters. Or, to skip that entirely, we can just use runOpaleyeConnection:

doOpaleyeStuff :: (e :> es) => IOE e -> PSQL.Connection -> Eff es [User]
doOpaleyeStuff ioe conn = BO.runOpaleyeConnection ioe conn insertAndList