polytropos-hasql: High-performance hasql PostgreSQL decoders for polytropos open records

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

High-performance PostgreSQL row decoding integrating polytropos open records with the hasql driver ecosystem.

Polytropos.Hasql.recordRow constructs a Hasql.Decoders.Row decoder that streams SQL columns directly into the contiguous Data.Primitive.SmallArray.SmallArray payload slots in row order. Completely bypasses GHC's 62-column tuple limit and avoids intermediate tuple allocations during query execution.

Start at the front door module Polytropos.Hasql for complete documentation, row decoder combinators, and worked examples.


[Skip to Readme]

Modules

  • Polytropos
    • Polytropos.Hasql

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1.0.2
Change log CHANGELOG.md
Dependencies base (>=4.14 && <5), hasql (>=1.6 && <1.10), polytropos-core (>=0.1 && <0.2), polytropos-plugin (>=0.1 && <0.2) [details]
License (EUPL-1.2 OR Apache-2.0)
Author Nadia Yvette Chambers
Maintainer nadia.yvette.chambers@ik.me
Uploaded by nyc at 2026-10-21T21:34:33Z
Category Database, PostgreSQL
Home page https://github.com/NadiaYvette/polytropos
Bug tracker https://github.com/NadiaYvette/polytropos/issues
Source repo head: git clone https://github.com/NadiaYvette/polytropos(packages/polytropos-hasql)
Distributions
Downloads 3 total (3 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-10-21 [all 1 reports]

Readme for polytropos-hasql-0.1.0.2

[back to package description]

polytropos-hasql

High-performance PostgreSQL row decoding and statement encoding integrating polytropos open records with hasql.

Overview

polytropos-hasql maps PostgreSQL binary query results directly into flat SmallArray payload slots, eliminating intermediate tuple allocations and tuple arity limits.

Features

  • Direct Binary Decoding: Unrolls RowDecoder directly into target record payload slots in wire order.
  • Statement Encoders: Encodes heterogeneous open records into query parameters.
  • Arity Freedom: Decodes wide database tables (e.g., >30 columns) beyond standard Haskell 62-tuple limits.

Quick Example

{-# LANGUAGE DataKinds #-}
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_GHC -fplugin=Polytropos.Plugin #-}

import qualified Hasql.Decoders as D
import Polytropos
import Polytropos.Hasql

type MetricRow = '[ "metric" := String, "value" := Double ]

-- Decode PostgreSQL columns directly into flat SmallArray slots:
metricDecoder :: D.Row (Record MetricRow)
metricDecoder = recordRow

License

Dual-licensed under EUPL-1.2 OR Apache-2.0.