Skip to content
BY-NC-ND 4.0 license Open Access Published by De Gruyter Open Access July 26, 2018

Call-by-need effects via coeffects

Dylan McDermott EMAIL logo and Alan Mycroft
From the journal Open Computer Science

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.

References

[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-39710.1007/978-3-642-39212-2_35Search in Google Scholar

[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-64510.1145/2535838.2535846Search in Google Scholar

[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-5710.1145/73560.73564Search in Google Scholar

[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-37310.1145/3009837.3009842Search in Google Scholar

[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-13510.1145/2628136.2628160Search in Google Scholar

[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-15410.1145/158511.158618Search in Google Scholar

[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-24610.1145/199448.199507Search in Google Scholar

[8] Mycroft A., Orchard D., Petricek T., Effect systems revisited - control-flow algebra and semantics, In: Semantics, Logics, and Calculi, Springer, 2016, 1-3210.1007/978-3-319-27810-0_1Search in Google Scholar

[9] Nielson F., Nielson H. R., Type and effect systems, In: Correct System Design, Recent Insight and Advances, Springer-Verlag, 1999, 114-13610.1007/3-540-48092-7_6Search in Google Scholar

[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-58110.1145/2837614.2837634Search in Google Scholar

[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-48910.1145/2951913.2951939Search in Google Scholar

[12] Moggi E., Notions of computation and monads, Information and Computation, 1991, 93(1), 55-9210.1016/0890-5401(91)90052-4Search in Google Scholar

[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-122Search in Google Scholar

[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-24210.1007/3-540-48959-2_17Search in Google Scholar

[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-41410.1007/s10990-006-0480-6Search in Google Scholar

[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-36010.1145/2103621.2103698Search in Google Scholar

[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-1110.1145/224164.224168Search in Google Scholar

[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-2810.1145/292540.292545Search in Google Scholar

[19] Ariola Z. M., Felleisen M., The call-by-need lambda calculus, Journal of Functional Programming, 1997, 7(3), 265-30110.1017/S0956796897002724Search in Google Scholar

[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-14710.1007/978-3-642-28869-2_7Search in Google Scholar

[21] Maraist J., Odersky M., Wadler P., The call-by-need lambda calculus, Journal of Functional Programming, 1998, 8(3), 275-31710.1017/S0956796898003037Search in Google Scholar

[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-16410.1145/1594834.1480903Search in Google Scholar

[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-28110.1007/3-540-09981-6_19Search in Google Scholar

[24] Schrijvers T., Mycroft A., Strictness meets data flow, In: Proceedings of the 17th International Conference on Static Analysis, Springer-Verlag, 2010, 439-45410.1007/978-3-642-15769-1_27Search in Google Scholar

[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-39210.1016/S1571-0661(04)00022-2Search in Google Scholar

[26] Seely R., Linear logic, *-autonomous categories and cofree coalgebras, In: Categories in Computer Science and Logic, American Mathematical Society, 1989, 371-38210.1090/conm/092/1003210Search in Google Scholar

[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.10.1007/978-3-642-18378-2_17Search in Google Scholar

Received: 2017-11-29
Accepted: 2018-05-18
Published Online: 2018-07-26

© 2018 Dylan McDermott and Alan Mycroft, published by De Gruyter

This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 License.

Downloaded on 2.12.2022 from frontend.live.degruyter.dgbricks.com/document/doi/10.1515/comp-2018-0009/html
Scroll Up Arrow