Answer-type modification without tears: Prompt-passing style translation for typed delimited-control operators

6Citations
Citations of this article
5Readers
Mendeley users who have this article in their library.

Abstract

The salient feature of delimited-control operators is their ability to modify answer types during computation. The feature, answer-type modification (ATM for short), allows one to express various interesting programs such as typed printf compactly and nicely, while it makes it difficult to embed these operators in standard functional languages. In this paper, we present a typed translation of delimited-control operators shift and reset with ATM into a familiar language with multi-prompt shift and reset without ATM, which lets us use ATM in standard languages without modifying the type system. Our translation generalizes Kiselyov's direct-style implementation of typed printf, which uses two prompts to emulate the modification of answer types, and passes them during computation. We prove that our translation preserves typing. As the naive prompt-passing style translation generates and passes many prompts even for pure terms, we show an optimized translation that generate prompts only when needed, which is also type-preserving. Finally, we give an implementation in the tagless-final style which respects typing by construction.

Cite

CITATION STYLE

APA

Kobori, I., Kameyama, Y., & Kiselyov, O. (2016). Answer-type modification without tears: Prompt-passing style translation for typed delimited-control operators. In Electronic Proceedings in Theoretical Computer Science, EPTCS (Vol. 212, pp. 36–52). Open Publishing Association. https://doi.org/10.4204/EPTCS.212.3

Register to see more suggestions

Mendeley helps you to discover research relevant for your work.

Already have an account?

Save time finding and organizing research with Mendeley

Sign up for free