Skip to main content

Towards Deriving Type Systems and Implementations for Coroutines

  • Conference paper
Programming Languages and Systems (APLAS 2010)

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 6461))

Included in the following conference series:

Abstract

Starting from reduction semantics for several styles of coroutines from the literature, we apply Danvy’s method to obtain equivalent functional implementations (definitional interpreters) for them. By applying existing type systems for programs with continuations, we obtain sound type systems for coroutines through the translation. The resulting type systems are similar to earlier hand-crafted ones. As a side product, we obtain implementations for these styles of coroutines in OCaml.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Anton, K., Thiemann, P.: Typing coroutines. In: Page, R., Zsók, V., Horváth, Z. (eds.) Eleventh Symposium on Trends in Functional Programming (draft proceedings), pp. 91–105. University of Oklahoma Printing Services (2010)

    Google Scholar 

  2. Asai, K., Kameyama, Y.: Polymorphic delimited continuations. In: Shao, Z. (ed.) APLAS 2007. LNCS, vol. 4807, pp. 239–254. Springer, Heidelberg (2007)

    Chapter  Google Scholar 

  3. Blazevic, M.: monad-coroutine: Coroutine monad transformer for suspending and resuming monadic computations (2010), http://hackage.haskell.org/package/monad-coroutine

  4. Carette, J., Kiselyov, O., Chieh Shan, C.: Finally tagless, partially evaluated: Tagless staged interpreters for simpler typed languages. J. Funct. Program. 19(5), 509–543 (2009)

    Article  MathSciNet  MATH  Google Scholar 

  5. Conway, M.E.: Design of a separable transition-diagram compiler. ACM Comm. 6(7), 396–408 (1963)

    Article  MATH  Google Scholar 

  6. Danvy, O.: Defunctionalized interpreters for programming languages, pp. 131–142 (2008)

    Google Scholar 

  7. Danvy, O., Filinski, A.: A functional abstraction of typed contexts. Technical Report 89/12, DIKU, University of Copenhagen (July 1989)

    Google Scholar 

  8. Danvy, O., Filinski, A.: Abstracting control. In: Proc. 1990 ACM Conference on Lisp and Functional Programming, Nice, France, pp. 151–160. ACM Press, New York (1990)

    Chapter  Google Scholar 

  9. Danvy, O., Millikin, K.: Refunctionalization at work. Science of Computer Programming 74(8), 534–549 (2009)

    Article  MathSciNet  MATH  Google Scholar 

  10. Danvy, O., Nielsen, L.R.: Refocusing in reduction semantics. Research Report BRICS RS-04-26, DAIMI, Department of Computer Science, University of Aarhus, Aarhus, Denmark (November 2004)

    Google Scholar 

  11. de Moura, A.L., Ierusalimschy, R.: Revisiting coroutines. ACM Trans. Program. Lang. Syst. 31(2), 1–31 (2009)

    Article  Google Scholar 

  12. de Moura, A.L., Rodriguez, N., Ierusalimschy, R.: Coroutines in Lua. Journal of Universal Computer Science 10, 925 (2004)

    Google Scholar 

  13. Friedman, D.P., Wand, M.: Essentials of Programming Languages, 3rd edn. MIT Press, McGraw-Hill (2008)

    Google Scholar 

  14. Haynes, C.T., Friedman, D.P., Wand, M.: Continuations and coroutines. In: ACM Conference on Lisp and Functional Programming, pp. 293–298 (1984)

    Google Scholar 

  15. Kiselyov, O.: Delimited control in OCaml, abstractly and concretely: System description. In: Blume, M., Kobayashi, N., Vidal, G. (eds.) FLOPS 2010. LNCS, vol. 6009, pp. 304–320. Springer, Heidelberg (2010)

    Chapter  Google Scholar 

  16. Marlin, C.D.: Coroutines: a programming methodology, a language design and an implementation. Springer, Heidelberg (1980)

    Book  MATH  Google Scholar 

  17. Microsoft Corp. C# Version 2.0 Specification (2005), http://msdn.microsoft.com/en-US/library/618ayhy6v=VS.80.aspx

  18. Pierce, B.C.: Types and Programming Languages. MIT Press, Cambridge (2002)

    MATH  Google Scholar 

  19. Thiemann, P.: Combinators for program generation. J. Funct. Program. 9(5), 483–525 (1999)

    Article  MathSciNet  MATH  Google Scholar 

  20. Van Rossum, G., Eby, P.: PEP 342 – coroutines via enhanced generators (2005), http://www.python.org/dev/peps/pep-0342/

  21. Wirth, N.: Programming in Modula-2. Springer, Heidelberg (1982)

    Book  MATH  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2010 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Anton, K., Thiemann, P. (2010). Towards Deriving Type Systems and Implementations for Coroutines. In: Ueda, K. (eds) Programming Languages and Systems. APLAS 2010. Lecture Notes in Computer Science, vol 6461. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-17164-2_6

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-17164-2_6

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-17163-5

  • Online ISBN: 978-3-642-17164-2

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics