@hackage valiant-bluefin0.1.0.0

Bluefin effect adapter for valiant

  • Installation

  • Tested Compilers

  • Dependencies (4)

  • Dependents (0)

  • Package Flags

      werror
       (off by default)

      Enable -Werror for development builds.

valiant-bluefin

Bluefin effect adapter for valiant.

Bluefin uses explicit effect handles rather than type-level effect lists. This adapter wraps a Pool as a ValiantHandle e that you pass to functions that need database access.

Quick start

import Valiant (newPool, defaultPoolConfig, poolConnString)
import Valiant.Bluefin

myApp :: ValiantHandle e -> IO [User]
myApp db = fetchAllB db listUsers ()

main :: IO ()
main = do
  pool <- newPool defaultPoolConfig { poolConnString = "postgres://..." }
  result <- runValiantB pool myApp
  print result

What you get

  • runValiantB :: Pool -> (forall e. ValiantHandle e -> IO a) -> IO a
  • Query operations: fetchOneB, fetchAllB, fetchScalarB, fetchOneOrThrowB, fetchExistsB
  • Command operations: executeB, executeReturningB, executeBatchB
  • Transactions: withTransactionB
  • Raw access: withConnectionB

See the valiant tutorial for the underlying Statement and valiant prepare workflow.