Safe typing of functional logic programs with opaque patterns and local bindings
Loading...
Full text at PDC
Publication date
2014
Advisors (or tutors)
Editors
Journal Title
Journal ISSN
Volume Title
Publisher
Elsevier
Citation
[1] L. Damas, R. Milner, Principal type-schemes for functional programs, in: Proceedings of the 9th ACM SIGPLAN-SIGACT Symposium on Principles of
Programming Languages, POPL ’82, ACM, 1982, pp. 207–212.
[2] F. López-Fraguas, J. Sánchez-Hernández, Toy: A multiparadigm declarative system, in: Proceedings of the 10th International Conference on Rewriting
Techniques and Applications, RTA ’99, in: Lect. Notes Comput. Sci., vol. 1631, Springer, 1999, pp. 244–247.
[3] M. Hanus, Curry: An integrated functional logic language (version 0.8.2), available at http://www.informatik.uni-kiel.de/~curry/report.html, 2006.
[4] M. Hanus, Multi-paradigm declarative languages, in: Proceedings of the 23rd International Conference on Logic Programming, ICLP ’07, in: Lect. Notes
Comput. Sci., vol. 4670, Springer, 2007, pp. 45–75.
[5] J.J. Moreno-Navarro, J. Mariño, A. del Pozo-Pietro, Á. Herranz-Nieva, J. García-Martín, Adding type classes to functional-logic languages, in: 1996 Joint
Conference on Declarative Programming, APPIA-GULP-PRODE ’96, pp. 427–438.
[6] W. Lux, Adding Haskell-style overloading to Curry, in: Workshop of Working Group 2.1.4 of the German Computing Science Association GI, pp. 67–76.
[7] E. Martin-Martin, Type classes in functional logic programming, in: Proceedings of the 2011 ACM SIGPLAN Workshop on Partial Evaluation and Program
Manipulation, PEPM ’11, ACM, 2011, pp. 121–130.
[8] J. González-Moreno, T. Hortalá-González, M. Rodríguez-Artalejo, A higher order rewriting logic for functional logic programming, in: Proceedings of the
14th International Conference on Logic Programming, ICLP ’97, MIT Press, 1997, pp. 153–167.
[9] F. López-Fraguas, J. Rodríguez-Hortalá, J. Sánchez-Hernández, Rewriting and call-time choice: the HO case, in: Proceedings of the 9th International
Symposium on Functional and Logic Programming, FLOPS ’08, in: Lect. Notes Comput. Sci., vol. 4989, Springer, 2008, pp. 147–162.
[10] R. Caballero, F. López-Fraguas, A functional-logic perspective on parsing, in: Proceedings of the 4th International Symposium on Functional and Logic
Programming, FLOPS ’99, Springer, 1999, pp. 85–99.
[11] R. Caballero, Y. García-Ruiz, F. Sáenz-Pérez, Integrating xpath with the functional-logic language toy, in: R. Rocha, J. Launchbury (Eds.), Proceedings
of the 13th International Symposium on Practical Aspects of Declarative Languages, PADL ’11, in: Lect. Notes Comput. Sci., vol. 6539, Springer, 2011,
pp. 145–159.
[12] S. Fischer, Call-time choice and extensionality – post to the Curry mailing list, http://www.informatik.uni-kiel.de/~curry/listarchive/0995.html, 2011.
[13] J. González-Moreno, T. Hortalá-González, M. Rodríguez-Artalejo, Polymorphic types in functional logic programming, J. Funct. Logic Program. (2001)
200
[14] B. Brassel, Two to three ways to write an unsafe type cast without importing unsafe – post to the Curry mailing list, http://www.informatik.uni-kiel.
de/~curry/listarchive/0705.html, 2008.
[15] F. López-Fraguas, E. Martin-Martin, J. Rodríguez-Hortalá, Liberal typing for functional logic programs, in: Proceedings of the 8th Asian Symposium on
Programming Languages and Systems, APLAS ’10, in: Lect. Notes Comput. Sci., vol. 6461, Springer, 2010, pp. 80–96.
[16] W. Lux, Münster Curry user’s guide, release 0.9.11, http://danae.uni-muenster.de/~lux/curry/user.html, 2007.
[17] A.K. Wright, Simple imperative polymorphism, LISP Symb. Comput. 8 (1995) 343–355.
[18] P. Hudak, J. Hughes, S. Peyton Jones, P. Wadler, A history of Haskell: Being lazy with class, in: Proceedings of the 3rd ACM SIGPLAN Conference on
History of Programming Languages, HOPL III, ACM, 2007, pp. 12-1–12-55.
[19] J.C. Mitchell, G.D. Plotkin, Abstract types have existential type, ACM Trans. Program. Lang. Syst. 10 (1988) 470–502.
[20] K. Läufer, M. Odersky, Polymorphic type inference and abstract data types, ACM Trans. Program. Lang. Syst. 16 (1994) 1411–1430.
[21] H. Xi, C. Chen, G. Chen, Guarded recursive datatype constructors, SIGPLAN Not. 38 (2003) 224–235.
[22] J. Cheney, R. Hinze, First-class phantom types, Technical Report TR2003-1901, Cornell University, 2003.
[23] L. Damas, Type assignment in programming languages, PhD thesis, University of Edinburgh, 1985; Also appeared as Technical report CST-33-85.
[24] S. Peyton Jones, The Implementation of Functional Programming Languages, Prentice-Hall International Series in Computer Science, 1987.
[25] A. Mycroft, Polymorphic type schemes and recursive definitions, in: Proceedings of the 6th Colloquium on International Symposium on Programming,
Springer, 1984, pp. 217–228.
[26] A.J. Kfoury, J. Tiuryn, P. Urzyczyn, Type reconstruction in the presence of polymorphic recursion, ACM Trans. Program. Lang. Syst. 15 (1993) 290–311.
[27] R. Tarjan, Depth-first search and linear graph algorithms, SIAM J. Comput. 1 (1972) 146–160.
[28] L. Cardelli, P. Wegner, On understanding types, data abstraction, and polymorphism, ACM Comput. Surv. 17 (1985) 471–522.
[29] N. Perry, The implementation of practical functional programming languages, PhD thesis, Imperial College, 1991.
[30] J.C. Reynolds, Types, abstraction and parametric polymorphism, Inf. Process. (1983) 513–523.
[31] P. Wadler, Theorems for free!, in: Proceedings of the 4th International Conference on Functional Programming Languages and Computer Architecture,
FPCA ’89, ACM, 1989, pp. 347–359.
[32] D. Seidel, J. Voigtländer, Automatically generating counterexamples to naive free theorems, in: Proceedings of 10th International Symposium on Functional
and Logic Programming, FLOPS ’10, in: Lect. Notes Comput. Sci., vol. 6009, Springer, 2010, pp. 175–190.
[33] P. Johann, J. Voigtländer, Free theorems in the presence of seq, in: Proceedings of the 31st ACM SIGPLAN-SIGACT Symposium on Principles of Programming
Languages, POPL ’04, ACM, 2004, pp. 99–110.
[34] J. Christiansen, D. Seidel, J. Voigtländer, Free theorems for functional logic programs, in: Proceedings of the 4th ACM SIGPLAN Workshop on Programming
Languages Meets Program Verification, PLPV ’10, ACM, 2010, pp. 39–48.
[35] T. Schrijvers, S. Peyton Jones, M. Sulzmann, D. Vytiniotis, Complete and decidable type inference for GADTs, in: Proceedings of the 14th ACM SIGPLAN
International Conference on Functional Programming, ICFP ’09, ACM, 2009, pp. 341–352.
[36] M. Odersky, M. Sulzmann, M. Wehr, Type inference with constrained types, Theory Pract. Object Syst. 5 (1999) 35–55.
[37] S. Antoy, M. Hanus, Overlapping rules and logic variables in functional logic programs, in: Proceedings of the 22nd International Conference on Logic
Programming, ICLP ’06, in: Lect. Notes Comput. Sci., vol. 4079, Springer, 2006, pp. 87–101.
[38] J. de Dios Castro, F.J. López-Fraguas, Extra variables can be eliminated from functional logic programs, Electron. Notes Theor. Comput. Sci. 188 (2007)
3–19.
[39] S. Antoy, M. Hanus, Functional logic programming, Commun. ACM 53 (2010) 74–85.
[40] S. Antoy, A. Tolmach, Typed higher-order narrowing without higher-order strategies, in: Proceedings of the 4th International Symposium on Functional
and Logic Programming, FLOPS ’99, in: Lect. Notes Comput. Sci., vol. 1722, Springer, 1999, pp. 335–352.
[41] F. López-Fraguas, E. Martin-Martin, J. Rodríguez-Hortalá, Well-typed narrowing with extra variables in functional-logic programming, in: Proceedings
of the 2012 ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation, PEPM ’12, ACM, 2012, pp. 83–92.
[42] F. López-Fraguas, E. Martin-Martin, J. Rodríguez-Hortalá, New results on type systems for functional logic programming, in: 18th International Workshop
on Functional and (Constraint) Logic Programming, WFLP ’09, revised selected papers, in: Lect. Notes Comput. Sci., vol. 5979, Springer, 2010,
pp. 128–144.
[43] E. Martin-Martin, Advances in type systems for functional logic programming, Master’s thesis, Universidad Complutense de Madrid, 2009, available at
http://gpd.sip.ucm.es/enrique/publications/master/masterThesis.pdf.
Abstract
Type systems are widely used in programming languages as a powerful tool providing safety to programs. Functional logic languages have inherited Damas-Milner type system from their functional part due to its simplicity and popularity. In this paper we address a couple of aspects that can be subject of improvement. One is related to a problematic feature of functional logic languages not taken under consideration by standard systems: it is known that the use of opaque HO patterns in left-hand sides of program rules may produce undesirable effects from the point of view of types. We re-examine the problem, and propose two variants of a Damas-Milner-like type system where certain uses of HO patterns (even opaque) are permitted while preserving type safety. The considered formal framework is that of programs without extra variables and using let-rewriting as reduction mechanism. The other aspect addressed is the different ways in which polymorphism of local definitions can be handled. At the same time that we formalize the type system, we have made the effort of technically clarifying the overall process of type inference in a whole program.