polytropos-beam: beam database schema integration for polytropos open records

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

Integration enabling polytropos open records to act as beam-core database tables and query projections without compiler out-of-memory crashes on wide schemas (50+ columns).

The Database.Beam.Schema.Tables.Beamable instance operates directly over the flat contiguous Data.Primitive.SmallArray.SmallArray payload: scaling column count costs exactly one array slot rather than exploding generic-representation AST trees during compilation.

Start at the front door module Polytropos.Beam for schema definitions, table wrappers, and worked examples.


[Skip to Readme]

Modules

[Index] [Quick Jump]

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), beam-core (>=0.9 && <0.12), 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:26Z
Category Database
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-beam)
Distributions
Downloads 3 total (3 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-10-22 [all 1 reports]

Readme for polytropos-beam-0.1.0.2

[back to package description]

polytropos-beam

Beam table and database entity bindings for polytropos open rows.

Overview

polytropos-beam bridges open rows with the beam-core database library, allowing open records to serve as database table schemas via PolyBeamRow.

Features

  • PolyBeamRow Schema: Higher-kinded table schema implementing Beamable.
  • Zero-Copy Column Derivation: Flattens table columns directly into SmallArray row representations.
  • Sub-Row Projection: Seamlessly slice wide database tables into narrow summary records.

Quick Example

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

import Database.Beam
import Polytropos
import Polytropos.Beam

type UserRow = '[ "id" := Int, "username" := String ]

-- 1. Construct Beam table directly from open record:
userRec :: Record UserRow
userRec = REC { id = 1, username = "Alice" }

userTable :: PolyBeamRow UserRow (TableField UserTable)
userTable = toBeamTable userRec

-- 2. Functional updates with unparenthesized REC_UPD:
updatedUser :: Record UserRow
updatedUser = REC_UPD userRec { username = "Bob" }

License

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