valiant-pipes: Pipes streaming adapter for valiant

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

Stream PostgreSQL query results using the pipes library. Provides cursor-based and fold-based producers as Producer r IO () values.


[Skip to Readme]

Modules

[Index] [Quick Jump]

Flags

Manual Flags

NameDescriptionDefault
werror

Enable -Werror for development builds.

Disabled

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0
Change log CHANGELOG.md
Dependencies base (>=4.17 && <5), pipes (>=4.3 && <4.4), valiant (>=0.1 && <0.2) [details]
Tested with ghc ==9.10.3
License BSD-3-Clause
Author Josh Burgess
Maintainer joshburgess.webdev@gmail.com
Uploaded by joshburgess at 2026-04-27T22:39:04Z
Category Database
Home page https://github.com/joshburgess/valiant
Bug tracker https://github.com/joshburgess/valiant/issues
Source repo head: git clone https://github.com/joshburgess/valiant(adapters/valiant-pipes)
Distributions
Downloads 5 total (5 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2026-04-28 [all 1 reports]

Readme for valiant-pipes-0.1.0.0

[back to package description]

valiant-pipes

Pipes streaming adapter for valiant.

Produces Producer r IO () values from query results, so they compose with the pipes ecosystem.

Quick start

import Valiant
import Valiant.Pipes
import Pipes
import Pipes.Prelude qualified as P

printAllUserNames :: Pool -> IO ()
printAllUserNames pool =
  withTransaction pool $ \tx ->
    runEffect $
      selectPipe (txConn tx) listAllUsers () 500
      >-> P.map userName
      >-> P.stdoutLn

Two streaming strategies

  • selectPipe conn stmt params batchSize — cursor-based. Must run inside a transaction.
  • foldPipe conn stmt params — single-shot extended-protocol query. No transaction required.

Both functions accumulate one result set at a time before yielding, so memory usage scales with the active batch (cursor) or the full result set (foldPipe). For truly incremental memory use, drive Valiant.withCursor / Valiant.fetchBatch directly.

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