A Rig of Transformations

📅 2026-08-11
📈 Citations: 0
Influential: 0
📄 PDF
🤖 AI Summary
This work addresses the gap between high-level abstractions and efficient or compatible binary layouts in functional languages, where users lack precise control over the low-level representation of data types. It formalizes layout transformations of finite algebraic data types as isomorphisms in a commutative rig (a ring without additive inverses), leveraging rig equations to characterize data layouts and their conversions. The approach introduces partial isomorphisms to accommodate type embeddings such as bit padding. Grounded in the categorical theory of rig algebras and isomorphisms, this framework uniformly handles both total and partial representation mappings, ensuring correctness and composability of layout transformations within the type system. Consequently, it provides an expressive, verifiable, and efficient mechanism for controlling low-level data representations.
📝 Abstract
In high-level functional languages, the compiler often gives users little control over the runtime representation of data types. Yet how we model data structures at the program level can be different to how we want to represent them at the binary level, for efficiency or legacy reasons. Hence being able to describe data layouts and their transformations for data types is a useful and necessary part of programming, but difficult to do correctly, efficiently and ergonomically. We present a model of finite algebraic data types as a commutative rig (a ring without additive inverses), where the rig-equalities are modelled by isomorphisms between data. Using this approach, we can also model embedding a data type into a larger type (e.g. bit-padding) as a partial isomorphism.
Problem

Research questions and friction points this paper is trying to address.

data representation
algebraic data types
data layout
type transformation
functional languages
Innovation

Methods, ideas, or system contributions that make the work stand out.

algebraic data types
commutative rig
isomorphisms
data layout
partial isomorphism
🔎 Similar Papers
No similar papers found.