Document Type
Conference Proceeding
Publication Date
10-8-2024
Published In
Proceedings Of The ACM On Programming Languages
Abstract
Functions in functional languages have a single elimination form—application—and cannot be compared, hashed, or subjected to other non-application operations. These operations can be approximated via defunctionalization: functions are replaced with first-order data and calls are replaced with invocations of a dispatch function. Operations such as comparison may then be implemented for these first-order data to approximate e.g. deduplication of continuations in algorithms such as unbounded searches. Unfortunately, this encoding is tedious, imposes a maintenance burden, and obfuscates the affected code. We introduce an alternative in intensional functions, a language feature which supports the definition of non-application operations in terms of a function’s definition site and closure-captured values. First-order data operations may be defined on intensional functions without burdensome code transformation. We give an operational semantics and type system and prove their formal properties. We further define intensional monads, whose Kleisli arrows are intensional functions, enabling monadic values to be similarly subjected to additional operations.
Conference
OOPSLA 2024
Conference Dates
October 23-25, 2024
Conference Location
Pasadena, CA
Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.
Recommended Citation
Zachary Palmer, N. W. Filardo, and K. Wu.
(2024).
"Intensional Functions".
Proceedings Of The ACM On Programming Languages.
Volume 8,
87-112.
DOI: 10.1145/3689714
https://works.swarthmore.edu/fac-comp-sci/128