Call-by-need effects via coeffects

Dylan McDermott 1  and Alan Mycroft 2
  • 1 Computer Laboratory,University of Cambridge,, Cambridge, UK
  • 2 Computer Laboratory, University of Cambridge,, Cambridge, UK

Abstract

Effect systems refine types with information about the behaviour of programs. They have been used for many purposes, such as optimizing programs, determining resource usage, and finding bugs. So far, however, work on effect systems has largely concentrated on call-by-value languages. We consider the problem of designing an effect system for a lazy language. This is more challenging because it depends on the ability to locate the first use of each variable. Coeffect systems, which track contextual requirements of programs, provide a method of doing this. We describe how to track variable usage in a coeffect system that can be instantiated for different reduction strategies, including call-by-need. We then add effects to the result, allowing work that has been done on effect systems for call-by-value languages to be applied to lazy languages.

If the inline PDF is not rendering correctly, you can download the PDF file here.

  • [1] Petricek T., Orchard D.,Mycroft A., Coeffects: Unified static analysis of context-dependence, In: Proceedings of the 40th International Conference on Automata, Languages, and Programming, Springer-Verlag, 2013, 385-397

  • [2] Katsumata S.-y., Parametric effect monads and semantics of effect systems, In: Proceedings of the 41st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, ACM, 2014, 633-645

  • [3] Lucassen J. M., Gifford D. K., Polymorphic effect systems, In: Proceedings of the 15th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, ACM, 1988, 47-57

  • [4] Hoffmann J., Das A., Weng S. C., Towards automatic resource bound analysis for OCaml, In: Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages, ACM, 2017, 359-373

  • [5] Petricek T., Orchard D., Mycroft A., Coeffects: A calculus of context-dependent computation, In: Proceedings of the 19th ACM SIGPLAN International Conference on Functional Programming, ACM, 2014, 123-135

  • [6] Launchbury J., A natural semantics for lazy evaluation, In: Proceedings of the 20th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, ACM, 1993, 144-154

  • [7] Ariola Z. M., Maraist J., Odersky M., Felleisen M., Wadler P., A call-by-need lambda calculus, In: Proceedings of the 22nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, ACM, 1995, 233-246

  • [8] Mycroft A., Orchard D., Petricek T., Effect systems revisited - control-flow algebra and semantics, In: Semantics, Logics, and Calculi, Springer, 2016, 1-32

  • [9] Nielson F., Nielson H. R., Type and effect systems, In: Correct System Design, Recent Insight and Advances, Springer-Verlag, 1999, 114-136

  • [10] Orchard D., Yoshida N., Effects as sessions, sessions as effects, In: Proceedings of the 43rd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, ACM, 2016, 568-581

  • [11] Gaboardi M., Katsumata S.-y., Orchard D., Breuvart F., Uustalu T., Combining effects and coeffects via grading, In: Proceedings of the 21st ACM SIGPLAN International Conference on Functional Programming, ACM, 2016, 476-489

  • [12] Moggi E., Notions of computation and monads, Information and Computation, 1991, 93(1), 55-92

  • [13] Benton N., Hughes J., Moggi E., Monads and effects, In: Applied Semantics, International Summer School, APPSEM 2000, Caminha, Portugal, September 9-15, 2000, Advanced Lectures, Springer-Verlag, 2002, 42-122

  • [14] Levy P. B., Call-by-push-value: A subsuming paradigm, In: Proceedings of the 4th International Conference on Typed Lambda Calculi and Applications, Springer-Verlag, 1999, 228-242

  • [15] Levy P. B., Call-by-push-value: Decomposing call-by-value and call-by-name, Higher-Order and Symbolic Computation, 2006, 19(4), 377-414

  • [16] Kammar O., Plotkin G. D., Algebraic foundations for effect-dependent optimisations, In: Proceedings of the 39th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, ACM, 2012, 349-360

  • [17] Turner D. N.,Wadler P., Mossin C., Once upon a type, In: Proceedings of the Seventh International Conference on Functional Programming Languages and Computer Architecture, ACM, 1995, 1-11

  • [18] Wansbrough K., Peyton Jones S., Once upon a polymorphic type, In: Proceedings of the 26th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, ACM, 1999, 15-28

  • [19] Ariola Z. M., Felleisen M., The call-by-need lambda calculus, Journal of Functional Programming, 1997, 7(3), 265-301

  • [20] Chang S., Felleisen M., The call-by-need lambda calculus, Revisited, In: Proceedings of the 21st European Conference on Programming Languages and Systems, Springer-Verlag, 2012, 128-147

  • [21] Maraist J., Odersky M., Wadler P., The call-by-need lambda calculus, Journal of Functional Programming, 1998, 8(3), 275-317

  • [22] Garcia R., Lumsdaine A., Sabry A., Lazy evaluation and delimited control, In: Proceedings of the 36th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, ACM, 2009, 153-164

  • [23] Mycroft A., The theory and practice of transforming call-by-need into call-by-value, In: Proceedings of the Fourth International Symposium on Programming, Springer-Verlag, 1980, 269-281

  • [24] Schrijvers T., Mycroft A., Strictness meets data flow, In: Proceedings of the 17th International Conference on Static Analysis, Springer-Verlag, 2010, 439-454

  • [25] Maraist J., Odersky M., Turner D. N., Wadler P., Call-by-name, call-by-value, call-by-need, and the linear lambda calculus, In: Proceedings of the Eleventh Annual Mathematical Foundations of Programming Semantics Conference, 1995, 370-392

  • [26] Seely R., Linear logic, *-autonomous categories and cofree coalgebras, In: Categories in Computer Science and Logic, American Mathematical Society, 1989, 371-382

  • [27] Petricek T., Syme D., Joinads: a retargetable control-flow construct for reactive, parallel and concurrent programming, In: Rocha R., Launchbury J. (Eds.), Proceedings of Practical Aspects of Declarative Languages, Springer, Berlin, Heidelberg, 2011, 205-219.

OPEN ACCESS

Journal + Issues

Open Computer Science is an open access, peer-reviewed journal. The journal publishes research results in the following fields: algorithms and complexity theory, artificial intelligence, bioinformatics, networking and security systems,
programming languages, system and software engineering, and theoretical foundations of computer science.

Search