Abstract
We present a linear functional calculus with both the safety guarantees expressible with linear types and the rich language of combinators and composition provided by functional programming. Unlike previous combinations of linear typing and functional programming, we compromise neither the linear side (for example, our linear values are first-class citizens of the language) nor the functional side (for example, we do not require duplicate definitions of compositions for linear and unrestricted functions). To do so, we must generalize abstraction and application to encompass both linear and unrestricted functions. We capture the typing of the generalized constructs with a novel use of qualified types. Our system maintains the metatheoretic properties of the theory of qualified types, including principal types and decidable type inference. Finally, we give a formal basis for our claims of expressiveness, by showing that evaluation respects linearity, and that our language is a conservative extension of existing functional calculi.
- A. J. Ahmed, M. Fluet, and G. Morrisett. A step-indexed model of substructural state. In Proceedings of the 10th ACM SIGPLAN International Conference on Functional Programming, ICFP 2005, Tallinn, Estonia, September 26-28, 2005, pages 78–91, 2005. Google Scholar
Digital Library
- R. Atkey. Parameterised notions of computation. J. Funct. Program., 19(3-4):335–376, 2009. Google Scholar
Digital Library
- A. Barber and G. Plotkin. Dual intuitionistic linear logic. Technical Report LFCS-96-347, University of Edinburgh, 1996.Google Scholar
- J. Boyland. Checking interference with fractional permissions. In Static Analysis, 10th International Symposium, SAS 2003, San Diego, CA, USA, June 11-13, 2003, Proceedings, pages 55–72, 2003. Google Scholar
Digital Library
- L. Caires and F. Pfenning. Session types as intuitionistic linear propositions. In CONCUR. Springer, 2010. Google Scholar
Digital Library
- C. Chen and P. Hudak. Rolling your own MADT - A connection between linear types and monads. In Conference Record of POPL’97: The 24th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, Papers Presented at the Symposium, Paris, France, 15-17 January 1997, pages 54–66, 1997. Google Scholar
Digital Library
- M. Fähndrich and R. DeLine. Adoption and focus: Practical linear types for imperative programming. In Proceedings of the 2002 ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI), Berlin, Germany, June 17-19, 2002, pages 13–24, 2002. Google Scholar
Digital Library
- A. Filinski. Linear continuations. In Conference Record of the Nineteenth Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, Albuquerque, New Mexico, USA, January 19-22, 1992, pages 27–38, 1992. Google Scholar
Digital Library
- E. Gan, J. A. Tov, and G. Morrisett. Type classes for lightweight substructural types. In Proceedings Third International Workshop on Linearity, LINEARITY 2014, Vienna, Austria, 13th July, 2014, pages 34–48, 2014.Google Scholar
- S. J. Gay and V. T. Vasconcelos. Linear type theory for asynchronous session types. J. Funct. Program., 20(1):19–50, 2010. Google Scholar
Digital Library
- J. Girard. Linear logic. Theor. Comput. Sci., 50:1–102, 1987. Google Scholar
Digital Library
- J. Gustavsson and J. Svenningsson. A usage analysis with bounded usage polymorphism and subtyping. In M. Mohnen and P. W. M. Koopman, editors, Implementation of Functional Languages, 12th International Workshop, IFL 2000, Aachen, Germany, September 4- 7, 2000, Selected Papers, volume 2011 of Lecture Notes in Computer Science, pages 140–157. Springer, 2000. Google Scholar
Digital Library
- J. C. Guzmán and P. Hudak. Single-threaded polymorphic lambda calculus. In Proceedings of the Fifth Annual Symposium on Logic in Computer Science (LICS ’90), Philadelphia, Pennsylvania, USA, June 4-7, 1990, pages 333–343, 1990.Google Scholar
Cross Ref
- J. Hage, S. Holdermans, and A. Middelkoop. A generic usage analysis with subeffect qualifiers. In R. Hinze and N. Ramsey, editors, Proceedings of the 12th ACM SIGPLAN International Conference on Functional Programming, ICFP 2007, Freiburg, Germany, October 1- 3, 2007, pages 235–246. ACM, 2007. Google Scholar
Digital Library
- S. Holdermans and J. Hage. Making ”stricterness” more relevant. Higher-Order and Symbolic Computation, 23(3):315–335, 2010. Google Scholar
Digital Library
- K. Honda. Types for dyadic interaction. In CONCUR. Springer, 1993. Google Scholar
Digital Library
- M. P. Jones. Qualified Types: Theory and Practice. Cambridge University Press, 1994. Google Scholar
Digital Library
- M. P. Jones. Simplifying and improving qualified types. In Proceedings of the seventh international conference on Functional programming languages and computer architecture, FPCA ’95, pages 160– 169, La Jolla, California, USA, 1995. ACM. Google Scholar
Digital Library
- M. P. Jones. First-class polymorphism with type inference. In P. Lee, F. Henglein, and N. D. Jones, editors, Conference Record of POPL’97: The 24th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, Papers Presented at the Symposium, Paris, France, 15-17 January 1997, pages 483–496. ACM Press, 1997. Google Scholar
Digital Library
- M. P. Jones. Type classes with functional dependencies. In Proceedings of the 9th European Symposium on Programming Languages and Systems, ESOP ’00, pages 230–244, Berlin, Germany, 2000. Springer-Verlag. Google Scholar
Digital Library
- J. Launchbury and R. Paterson. Parametricity and unboxing with unpointed types. In H. R. Nielson, editor, Programming Languages and Systems - ESOP’96, 6th European Symposium on Programming, Linköping, Sweden, April 22-24, 1996, Proceedings, volume 1058 of Lecture Notes in Computer Science, pages 204–218. Springer, 1996. Google Scholar
Digital Library
- O. Lee and K. Yi. Proofs about a folklore let-polymorphic type inference algorithm. ACM Trans. Program. Lang. Syst., 20(4):707– 723, 1998. Google Scholar
Digital Library
- S. Lindley and J. G. Morris. A semantics for propositions as sessions. In J. Vitek, editor, Programming Languages and Systems - 24th European Symposium on Programming, ESOP 2015, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2015, London, UK, April 11-18, 2015. Proceedings, volume 9032 of Lecture Notes in Computer Science, pages 560–584. Springer, 2015.Google Scholar
- K. Mazurak, J. Zhao, and S. Zdancewic. Lightweight linear types in System F ◦. In TLDI, 2010. Google Scholar
Digital Library
- J. G. Morris. The best of both worlds: Linear functional programming without compromise (extended version). http://homepages.inf. ed.ac.uk/jmorri14/, 2016.Google Scholar
- G. Morrisett, A. J. Ahmed, and M. Fluet. L3: A linear language with locations. In P. Urzyczyn, editor, Typed Lambda Calculi and Applications, 7th International Conference, TLCA 2005, Nara, Japan, April 21-23, 2005, Proceedings, volume 3461 of Lecture Notes in Computer Science, pages 293–307. Springer, 2005. Google Scholar
Digital Library
- P. W. O’Hearn and D. J. Pym. The logic of bunched implications. Bulletin of Symbolic Logic, 5(2):215–244, 1999.Google Scholar
Cross Ref
- T. Petricek, D. A. Orchard, and A. Mycroft. Coeffects: a calculus of context-dependent computation. In J. Jeuring and M. M. T. Chakravarty, editors, Proceedings of the 19th ACM SIGPLAN international conference on Functional programming, Gothenburg, Sweden, September 1-3, 2014, pages 123–135. ACM, 2014. Google Scholar
Digital Library
- R. Pucella and J. A. Tov. Haskell session types with (almost) no class. In Proceedings of the 1st ACM SIGPLAN Symposium on Haskell, Haskell 2008, Victoria, BC, Canada, 25 September 2008, pages 25– 36. ACM, 2008. Google Scholar
Digital Library
- J. C. Reynolds. Syntactic control of interference. In A. V. Aho, S. N. Zilles, and T. G. Szymanski, editors, Conference Record of the Fifth Annual ACM Symposium on Principles of Programming Languages, Tucson, Arizona, USA, January 1978, pages 39–46. ACM Press, 1978. Google Scholar
Digital Library
- S. Smetsers, E. Barendsen, M. C. J. D. van Eekelen, and M. J. Plasmeijer. Guaranteeing safe destructive updates through a type system with uniqueness information for graphs. In H. J. Schneider and H. Ehrig, editors, Graph Transformations in Computer Science, International Workshop, Dagstuhl Castle, Germany, January 1993, Proceedings, volume 776 of Lecture Notes in Computer Science, pages 358–379. Springer, 1993. Google Scholar
Digital Library
- F. Smith, D. Walker, and J. G. Morrisett. Alias types. In G. Smolka, editor, Programming Languages and Systems, 9th European Symposium on Programming, ESOP 2000, Held as Part of the European Joint Conferences on the Theory and Practice of Software, ETAPS 2000, Berlin, Germany, March 25 - April 2, 2000, Proceedings, volume 1782 of Lecture Notes in Computer Science, pages 366–381. Springer, 2000. Google Scholar
Digital Library
- J. A. Tov and R. Pucella. Practical affine types. In T. Ball and M. Sagiv, editors, Proceedings of the 38th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2011, Austin, TX, USA, January 26-28, 2011, pages 447–458. ACM, 2011. Google Scholar
Digital Library
- V. T. Vasconcelos, S. J. Gay, and A. Ravara. Type checking a multithreaded functional language with session types. Theor. Comput. Sci., 368(1-2):64–87, 2006. Google Scholar
Digital Library
- P. Wadler. A taste of linear logic. In Mathematical Foundations of Computer Science 1993, 18th International Symposium, MFCS’93, Gdansk, Poland, August 30 - September 3, 1993, Proceedings, pages 185–210, 1993. Google Scholar
Digital Library
- P. Wadler. Propositions as sessions. J. Funct. Program., 24(2-3):384– 418, 2014.Google Scholar
Cross Ref
- D. Walker. Substructural type systems. In B. C. Pierce, editor, Advanced Topics in Types and Programming Languages, chapter 1. The MIT Press, 2004.Google Scholar
- D. Walker, K. Crary, and J. G. Morrisett. Typed memory management via static capabilities. ACM Trans. Program. Lang. Syst., 22(4):701– 771, 2000. Google Scholar
Digital Library
Index Terms
The best of both worlds: linear functional programming without compromise
Recommendations
The best of both worlds: linear functional programming without compromise
ICFP 2016: Proceedings of the 21st ACM SIGPLAN International Conference on Functional ProgrammingWe present a linear functional calculus with both the safety guarantees expressible with linear types and the rich language of combinators and composition provided by functional programming. Unlike previous combinations of linear typing and functional ...
Qualified types for MLF
Proceedings of the tenth ACM SIGPLAN international conference on Functional programmingMLF is a type system that extends a functional language with impredicative rank-n polymorphism. Type inference remains possible and only in some clearly defined situations, a local type annotation is required. Qualified types are a general concept that ...
Qualified types for MLF
ICFP '05: Proceedings of the tenth ACM SIGPLAN international conference on Functional programmingMLF is a type system that extends a functional language with impredicative rank-n polymorphism. Type inference remains possible and only in some clearly defined situations, a local type annotation is required. Qualified types are a general concept that ...







Comments