row-polymorphism

Implement row polymorphism for extensible records and variants in type systems.

17|2|Updated Feb 16, 2026
One-click install
npx skills add https://github.com/rainoftime/pl-skills --skill row-polymorphism
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: row-polymorphism
Source: https://github.com/rainoftime/pl-skills/tree/main/row-polymorphism
Command: npx skills add https://github.com/rainoftime/pl-skills --skill row-polymorphism

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the challenge of creating flexible data structures like records and variants that can be extended without modifying their original definitions, crucial for building adaptable languages and systems.

Core Features & Use Cases

  • Extensible Records/Variants: Design languages with records and variants that can grow without nominal inheritance.
  • Type-Safe Extensibility: Implement structural extensibility while maintaining type safety through row variables and unification.
  • Use Case: When building a new programming language, use this Skill to define its core data structures, allowing users to add new fields to existing record types or new variants to sum types in a type-safe manner.

Quick Start

Implement row polymorphism for extensible records using type-level lists and row variables.

Frequently Asked Questions about row-polymorphism

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement extensible records and variants in a new programming language?

Row polymorphism enables structural extensibility in type systems by modeling open rows with row variables. It allows data structures like records and variants to grow without requiring nominal inheritance or modifying their original type definitions.

How does row unification work for type-safe extensible records?

Row unification solves type constraints by matching row variables during type inference, ensuring correct label scoping. This mechanism allows the type system to safely resolve overlapping fields when extending records or sum types without structural conflicts.

When do I need row polymorphism instead of nominal inheritance for language design?

Use row polymorphism when building language designs requiring type-safe structural extensibility without nominal inheritance. It is essential when users need to dynamically add new fields to record types or new cases to sum types independently of the original definition.

Can I use row polymorphism to design type-safe database queries?

Yes, row polymorphism supports type-safe database queries by modeling open rows with row variables, allowing query schemas to be structurally extended. This ensures dynamically combined or extended query results maintain strict type safety during row unification.

What are the limitations of using row variables for subtyping?

Using row variables for subtyping requires correct row constraint solving and label scoping to avoid unification conflicts. Limitations arise when structural extensibility demands complex overlapping label management, necessitating strict type inference rules to maintain type safety.