## Polymorphic Delimited Continuations (2007)

### Cached

### Download Links

- [www.cs.tsukuba.ac.jp]
- [logic.cs.tsukuba.ac.jp]
- [logic.cs.tsukuba.ac.jp]
- DBLP

### Other Repositories/Bibliography

Venue: | In Proc. Asian Programming Languages and Systems, LNCS 4807 |

Citations: | 19 - 10 self |

### BibTeX

@TECHREPORT{Asai07polymorphicdelimited,

author = {Kenichi Asai and Yukiyoshi Kameyama},

title = {Polymorphic Delimited Continuations},

institution = {In Proc. Asian Programming Languages and Systems, LNCS 4807},

year = {2007}

}

### OpenURL

### Abstract

Abstract. This paper presents a polymorphic type system for a language with delimited control operators, shift and reset. Based on the monomorphic type system by Danvy and Filinski, the proposed type system allows pure expressions to be polymorphic. Thanks to the explicit presence of answer types, our type system satisfies various important properties, including strong type soundness, existence of principal types and an inference algorithm, and strong normalization. Relationship to CPS translation as well as extensions to impredicative polymorphism are also discussed. These technical results establish the foundation of polymorphic delimited continuations.

### Citations

540 | A syntactic approach to type soundness
- Wright, Felleisen
- 1994
(Show Context)
Citation Context ... system that allows modification of answer types but is restricted to monomorphic types. Polymorphism in the presence of call/cc has been discussed in the context of ML [11] but strong type soundness =-=[21]-=- does not hold for their type system. Gunter, Rémy, and Riecke [10] proposed typed cupto operator with strong type soundness theorem as well as various properties, but their type system is restricted ... |

156 |
Fundamental concepts in programming languages
- Strachey
- 1967
(Show Context)
Citation Context ...r work with related work and give conclusion. Proofs of theorems in this paper can be found in the extended version of this paper [3]. 2 Programming Examples Polymorphism is inevitable in programming =-=[17]-=-. A simple example of polymorphism is found in list manipulating functions: a reverse function works for a list of elements of any type. In this section, we introduce the control operators, shift and ... |

140 |
Proofs and Types, volume 7 of Cambridge Tracts
- Girard, Lafont, et al.
- 1989
(Show Context)
Citation Context ...turally defined for our polymorphic calculus and preserves types and equivalence. Because of its natural connection to CPS, our framework can be extended to a calculus with impredicative polymorphism =-=[9]-=-. Unrestricted polymorphism in the presence of control operators leads to an unsound type system [11]. We introduce and employ a new criteria called “purity” restriction instead of more restrictive va... |

129 | Representing monads
- Filinski
- 1994
(Show Context)
Citation Context ...). In particular, shift and reset, introduced by Danvy and Filinski [6], have strong connection to CPS, and thus most of the control effects compatible with CPS can be expressed using shift and reset =-=[8]-=-. They have been used, for example, to program backtracking [6], A-normalization in direct style [1], let-insertion in partial evaluation [1], and type-safe “printf” in direct style [2]. Despite the i... |

111 |
Type inference for polymorphic references
- Tofte
- 1990
(Show Context)
Citation Context ... solve this problem by restricting the let-expression let x = e1 in e2 or by changing its operational semantics, some of which are: – Value restriction [20]: e1 must be a value. – Weak type variables =-=[19]-=-: the type variable in the type of e1 can be generalized only when it is not related to side effects. – Polymorphism by name [15]: the evaluation of e1 is postponed until x is actually used in e2, thu... |

95 | Abstracting control
- Danvy, Filinski
- 1990
(Show Context)
Citation Context ...semantics of control operators have often been given through a CPS translation. In their first proposal, Danvy and Filinski gave the precise semantics of shift and reset in terms of a CPS translation =-=[6, 7]-=-. In this section, we show that it can be naturally extended to polymorphic setting. Harper and Lillibridge [12] were the first to systematically study CPS translations in polymorphic language with co... |

93 | Typing first-class continuations in ML
- Duba, Harper, et al.
- 1987
(Show Context)
Citation Context ...d Filinski [5] is the only type system that allows modification of answer types but is restricted to monomorphic types. Polymorphism in the presence of call/cc has been discussed in the context of ML =-=[11]-=- but strong type soundness [21] does not hold for their type system. Gunter, Rémy, and Riecke [10] proposed typed cupto operator with strong type soundness theorem as well as various properties, but t... |

92 | Simple imperative polymorphism
- Wright
- 1995
(Show Context)
Citation Context .... In the literature, there are many proposals to solve this problem by restricting the let-expression let x = e1 in e2 or by changing its operational semantics, some of which are: – Value restriction =-=[20]-=-: e1 must be a value. – Weak type variables [19]: the type variable in the type of e1 can be generalized only when it is not related to side effects. – Polymorphism by name [15]: the evaluation of e1 ... |

81 | Representing control: A study of the CPS transformation
- Danvy, Filinski
- 1992
(Show Context)
Citation Context ...semantics of control operators have often been given through a CPS translation. In their first proposal, Danvy and Filinski gave the precise semantics of shift and reset in terms of a CPS translation =-=[6, 7]-=-. In this section, we show that it can be naturally extended to polymorphic setting. Harper and Lillibridge [12] were the first to systematically study CPS translations in polymorphic language with co... |

68 | Explicit polymorphism and CPS conversion
- Harper, Lillibridge
- 1993
(Show Context)
Citation Context ... Filinski gave the precise semantics of shift and reset in terms of a CPS translation [6, 7]. In this section, we show that it can be naturally extended to polymorphic setting. Harper and Lillibridge =-=[12]-=- were the first to systematically study CPS translations in polymorphic language with control operators. They introduced CPS translations from F ω+call/cc to F ω, and proved that, under a condition si... |

65 | A functional abstraction of typed contexts
- Danvy, Filinski
- 1989
(Show Context)
Citation Context ...ogramming languages, there has been little work that investigates their basic properties without sacrificing their expressive power. The original type system for shift and reset by Danvy and Filinski =-=[5]-=- is the only type system that allows modification of answer types but is restricted to monomorphic types. Polymorphism in the presence of call/cc has been discussed in the context of ML [11] but stron... |

61 | A generalization of exceptions and control in ML-like languages
- Gunter, Rémy, et al.
- 1995
(Show Context)
Citation Context ...to monomorphic types. Polymorphism in the presence of call/cc has been discussed in the context of ML [11] but strong type soundness [21] does not hold for their type system. Gunter, Rémy, and Riecke =-=[10]-=- proposed typed cupto operator with strong type soundness theorem as well as various properties, but their type system is restricted to a fixed answer type for each prompt. As such, none of the above ... |

31 | Delimited dynamic binding
- Kiselyov, Shan, et al.
(Show Context)
Citation Context ...h shift and reset. However, the expressivity of his system is limited since the answer type is fixed once and for all. The same goes for the calculus with cupto by Gunter et al. [10]. Kiselyov et al. =-=[14]-=- have implemented shift and reset in OCaml, and their examples made use of let-polymorphism. However, their paper did not give formal accounts for polymorphism. As far as we know, the present paper is... |

31 | Polymorphism by name for references and continuations
- Leroy
- 1993
(Show Context)
Citation Context ...e: – Value restriction [20]: e1 must be a value. – Weak type variables [19]: the type variable in the type of e1 can be generalized only when it is not related to side effects. – Polymorphism by name =-=[15]-=-: the evaluation of e1 is postponed until x is actually used in e2, thus enforcing the call-by-name evaluation to e1. We take an alternative approach: we restrict that e1 in let x = e1 in e2 must be f... |

19 |
An Analytical Approach to Program as Data Objects. DSc thesis
- Danvy
- 2006
(Show Context)
Citation Context ...t / bool. To unify them, add1 has to be given a polymorphic type: int / ’a -> int / ’a. Answer type polymorphism plays an important role in captured continuations, too. Consider the following program =-=[4]-=-:slet rec visit lst = match lst with [] -> shift (fun h -> []) | a :: rest -> a :: shift (fun k -> (k []) :: reset (k (visit rest))) let rec prefix lst = reset (visit lst) When applied to a list, e.g.... |

19 | From control effects to typed continuation passing
- Thielecke
(Show Context)
Citation Context ...sound type system [11]. We introduce and employ a new criteria called “purity” restriction instead of more restrictive value restriction. An expression is said to be pure if it has no control-effects =-=[18]-=-. By allowing pure expressions to be polymorphic, an interesting non-value term can be given a polymorphic type. Based on these results, we have implemented a prototypical type inference algorithm, an... |

10 | Relational parametricity and control
- Hasegawa
(Show Context)
Citation Context ...rst author of the present paper has studied logical relations based on Danvy and Filinski’s monomorphic type system [1], but it is not apparent if his result extends to the polymorphic case. Hasegawa =-=[13]-=- studied parametricity principle for the second order, callby-name λµ-calculus (similar to System F + call/cc), and obtained the notion of “focal parametricity”. Although he works in call-by-name, we ... |

10 |
Relational parametricity for computational effects
- Simpson
- 2006
(Show Context)
Citation Context ...obtained the notion of “focal parametricity”. Although he works in call-by-name, we hope to findssome connection between our work and his results in the future. A recent work by Mogelberg and Simpson =-=[16]-=- treats a similar notion in call-by-value. Acknowledgments. We would like to thank Olivier Danvy and Masahito Hasegawa for helpful comments and suggestions. This work was partly supported by JSPS Gran... |

9 | On Typing Delimited Continuations: Three New Solutions to the Printf Problem
- Asai
- 2009
(Show Context)
Citation Context ...t / ’b -> ’a list / (’a list -> ’b), 6 where ’a list -> ’b is a shorthand for ’a list / ’c -> ’b / ’c for a new type variable ’c. Given this type, the type of append123, i.e., reset (fun () -> append =-=[1; 2; 3]-=-), becomes int list -> int list (or int list / ’c -> int list / ’c). Since it is pure, append123 can be given a polymorphic type in its answer type ’c. Notice that append123 is not bound to a value bu... |

3 | Logical Relations for Call-by-value Delimited Continuations,” Trends
- Asai
- 2007
(Show Context)
Citation Context ...PS, and thus most of the control effects compatible with CPS can be expressed using shift and reset [8]. They have been used, for example, to program backtracking [6], A-normalization in direct style =-=[1]-=-, let-insertion in partial evaluation [1], and type-safe “printf” in direct style [2]. Despite the increasing interest in the use of delimited continuations in typed programming languages, there has b... |