License: Creative Commons Attribution 4.0 International license (CC BY 4.0)
When quoting this document, please refer to the following
DOI: 10.4230/LIPIcs.ECOOP.2022.5
URN: urn:nbn:de:0030-drops-162339
URL: http://dagstuhl.sunsite.rwth-aachen.de/volltexte/2022/16233/
Marshall, Daniel ;
Orchard, Dominic
How to Take the Inverse of a Type
Abstract
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.
BibTeX - Entry
@InProceedings{marshall_et_al:LIPIcs.ECOOP.2022.5,
author = {Marshall, Daniel and Orchard, Dominic},
title = {{How to Take the Inverse of a Type}},
booktitle = {36th European Conference on Object-Oriented Programming (ECOOP 2022)},
pages = {5:1--5:27},
series = {Leibniz International Proceedings in Informatics (LIPIcs)},
ISBN = {978-3-95977-225-9},
ISSN = {1868-8969},
year = {2022},
volume = {222},
editor = {Ali, Karim and Vitek, Jan},
publisher = {Schloss Dagstuhl -- Leibniz-Zentrum f{\"u}r Informatik},
address = {Dagstuhl, Germany},
URL = {https://drops.dagstuhl.de/opus/volltexte/2022/16233},
URN = {urn:nbn:de:0030-drops-162339},
doi = {10.4230/LIPIcs.ECOOP.2022.5},
annote = {Keywords: linear types, regular types, algebra of programming, derivatives}
}
Keywords: |
|
linear types, regular types, algebra of programming, derivatives |
Collection: |
|
36th European Conference on Object-Oriented Programming (ECOOP 2022) |
Issue Date: |
|
2022 |
Date of publication: |
|
23.06.2022 |
Supplementary Material: |
|
Software (ECOOP 2022 Artifact Evaluation approved artifact): https://doi.org/10.4230/DARTS.8.2.1 |