polytropos-plugin: TcPlugin that emits literal evidence for Polytropos row classes

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

A GHC typechecker plugin for polytropos that solves the evidence-class constraints (Polytropos.Core.FieldIndex, Polytropos.Core.ConstructorIndex, Polytropos.Core.RowEq, Polytropos.Core.RowShow, Polytropos.Core.RowEqSum, Polytropos.Core.RowShowSum, Polytropos.Core.AllFields) by inspecting the row carried in a Polytropos.Core.RowRep's type and emitting literal slot indices, tags, and dictionary vectors directly into GHC Core AST — eliminating inductive type-level search and pointer-chasing runtime overhead entirely.

Uses the ghc-tcplugin-api library for a streamlined interface to GHC's typechecker plugin API across compiler versions.

Start at the front door module Polytropos.Plugin for complete usage instructions and worked examples. Enable in consuming packages via: ghc-options: -fplugin=Polytropos.Plugin.


[Skip to Readme]

Properties

Versions 0.1.0.0, 0.1.0.2
Change log CHANGELOG.md
Dependencies base (>=4.18 && <4.23), ghc (>=9.6 && <9.15), ghc-tcplugin-api (>=0.1 && <0.21) [details]
License (EUPL-1.2 OR Apache-2.0)
Author Nadia Yvette Chambers
Maintainer nadia.yvette.chambers@ik.me
Category Compiler Plugin
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-plugin)
Uploaded by nyc at 2026-10-17T18:55:12Z

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Readme for polytropos-plugin-0.1.0.0

[back to package description]

polytropos-plugin

GHC typechecker plugin synthesizing literal dictionaries and \(O(1)\) jump tables directly into Core AST for polytropos.

Overview

In traditional Haskell row libraries, solving field offsets or dictionary instances involves either:

  1. Recursive type-level search (\(O(N)\) or \(O(N^2)\) compile-time scaling).
  2. Runtime dictionary passing and pointer chasing.

polytropos-plugin solves evidence constraints (FieldIndex, ConstructorIndex, RowEq, RowShow, RowEqSum, RowShowSum, AllFields) by inspecting the row at compile time and emitting literal slot indices, tags, and dictionary vectors directly into GHC Core AST.

Usage

Enable the plugin in your .cabal file or module:

build-depends:
    polytropos-core >= 0.1 && < 0.2
  , polytropos-plugin >= 0.1 && < 0.2

ghc-options: -fplugin=Polytropos.Plugin

Features

Documentation & Repository

License

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