Skip to main content

How to Take the Inverse of a Type

Marshall, Daniel, Orchard, Dominic A. (2022) How to Take the Inverse of a Type. In: Leibniz International Proceedings in Informatics. Proceedings of 36th European Conference on Object-Oriented Programming (ECOOP 2022). . Dagstuhl ISBN 978-3-95977-225-9. (doi:10.4230/LIPIcs.ECOOP.2022.5) (KAR id:98022)

PDF Publisher pdf
Language: English

Download (1MB) Preview
[thumbnail of LIPIcs-ECOOP-2022-5.pdf]
This file may not be suitable for users of assistive technology.
Request an accessible format
Official URL:


In functional programming, regular types are a subset of algebraic data types formed from products and sums with their respective units. One can view regular types as forming a commutative semiring but where the usual axioms are isomorphisms rather than equalities. In this pearl, we show that regular types in a linear setting permit a useful notion of multiplicative inverse, allowing us to “divide” one type by another. Our adventure begins with an exploration of the properties and applications of this construction, visiting various topics from the literature including program calculation, Laurent polynomials, and derivatives of data types. Examples are given throughout using Haskell’s linear types extension to demonstrate the ideas. We then step through the looking glass to discover what might be possible in richer settings; the functional language Granule offers linear functions that incorporate local side effects, which allow us to demonstrate further algebraic structure. Lastly, we discuss whether dualities in linear logic might permit the related notion of an additive inverse.

Item Type: Conference or workshop item (Proceeding)
DOI/Identification number: 10.4230/LIPIcs.ECOOP.2022.5
Uncontrolled keywords: linear types, regular types, algebra of programming, derivatives
Subjects: Q Science > QA Mathematics (inc Computing science) > QA 76 Software, computer programming,
Divisions: Divisions > Division of Computing, Engineering and Mathematical Sciences > School of Computing
Funders: Engineering and Physical Sciences Research Council (
Depositing User: Dominic Orchard
Date Deposited: 15 Nov 2022 15:40 UTC
Last Modified: 16 Nov 2022 16:29 UTC
Resource URI: (The current URI for this page, for reference purposes)
Marshall, Daniel:
Orchard, Dominic A.:
  • Depositors only (login required):


Downloads per month over past year