Skip to main content

Liberal Typing for Functional Logic Programs

  • 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

We propose a new type system for functional logic programming which is more liberal than the classical Damas-Milner usually adopted, but it is also restrictive enough to ensure type soundness. Starting from Damas-Milner typing of expressions we propose a new notion of well-typed program that adds support for type-indexed functions, existential types, opaque higher-order patterns and generic functions—as shown by an extensive collection of examples that illustrate the possibilities of our proposal. In the negative side, the types of functions must be declared, and therefore types are checked but not inferred. Another consequence is that parametricity is lost, although the impact of this flaw is limited as “free theorems” were already compromised in functional logic programming because of non-determinism.

This work has been partially supported by the Spanish projects TIN2008-06622-C03-01, S2009TIC-1465 and UCM-BSCH-GR58/08-910502.

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

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. Antoy, S., Tolmach, A.P.: Typed higher-order narrowing without higher-order strategies. In: Middeldorp, A. (ed.) FLOPS 1999. LNCS, vol. 1722, pp. 335–353. Springer, Heidelberg (1999)

    Chapter  Google Scholar 

  2. van Bakel, S., Fernández, M.: Normalization Results for Typeable Rewrite Systems. Information and Computation 133(2), 73–116 (1997)

    Article  MathSciNet  MATH  Google Scholar 

  3. Cheney, J., Hinze, R.: First-class phantom types. Tech. Rep. TR2003-1901, Cornell University (2003)

    Google Scholar 

  4. Christiansen, J., Seidel, D., Voigtländer, J.: Free theorems for functional logic programs. In: Proc. PLPV 2010, pp. 39–48. ACM, New York (2010)

    Google Scholar 

  5. Damas, L., Milner, R.: Principal type-schemes for functional programs. In: Proc. POPL 1982, pp. 207–212. ACM, New York (1982)

    Google Scholar 

  6. González-Moreno, J.C., Hortalá-González, T., López-Fraguas, F., Rodríguez-Artalejo, M.: An approach to declarative programming based on a rewriting logic. Journal of Logic Programming 40(1), 47–87 (1999)

    Article  MathSciNet  MATH  Google Scholar 

  7. González-Moreno, J., Hortalá-González, M., Rodríguez-Artalejo, M.: A higher order rewriting logic for functional logic programming. In: Hill, P.M., Warren, D.S. (eds.) Proc. ICLP 1997, pp. 153–167. MIT Press, Cambridge (1997)

    Google Scholar 

  8. Gonzalez-Moreno, J.C., Hortala-Gonzalez, M.T., Rodriguez-Artalejo, M.: Polymorphic types in functional logic programming. Journal of Functional and Logic Programming 2001(1) (2001)

    Google Scholar 

  9. Hanus, M.: Multi-paradigm declarative languages. In: Dahl, V., Niemelä, I. (eds.) ICLP 2007. LNCS, vol. 4670, pp. 45–75. Springer, Heidelberg (2007)

    Chapter  Google Scholar 

  10. Hanus, M. (ed.): Curry: An integrated functional logic language, version 0.8.2 (2006), http://www.informatik.uni-kiel.de/~curry/report.html

  11. Hinze, R.: Generics for the masses. J. Funct. Program. 16(4-5), 451–483 (2006)

    Article  MathSciNet  MATH  Google Scholar 

  12. Hinze, R., Löh, A.: Generic programming, now! In: Backhouse, R., Gibbons, J., Hinze, R., Jeuring, J. (eds.) SSDGP 2006. LNCS, vol. 4719, pp. 150–208. Springer, Heidelberg (2007)

    Chapter  Google Scholar 

  13. Hudak, P., Hughes, J., Jones, S.P., Wadler, P.: A History of Haskell: being lazy with class. In: Proc. HOPL III, pp. 12-1–12-55. ACM, New York (2007)

    Google Scholar 

  14. Läufer, K., Odersky, M.: Polymorphic type inference and abstract data types. ACM Transactions on Programming Languages and Systems 16. ACM (1994)

    Google Scholar 

  15. Löh, A., Hinze, R.: Open data types and open functions. In: Proc. PPDP 2006, pp. 133–144. ACM, New York (2006)

    Google Scholar 

  16. López-Fraguas, F.J., Martin-Martin, E., Rodríguez-Hortalá, J.: Liberal Typing for Functional Logic Programs (long version). Tech. Rep. SIC-UCM, Universidad Complutense de Madrid (August 2010), http://gpd.sip.ucm.es/enrique/publications/liberalTypingFLP/long.pdf

  17. López-Fraguas, F.J., Martin-Martin, E., Rodríguez-Hortalá, J.: New results on type systems for functional logic programming. In: Escobar, S. (ed.) Functional and Constraint Logic Programming. LNCS, vol. 5979, pp. 128–144. Springer, Heidelberg (2010)

    Chapter  Google Scholar 

  18. López-Fraguas, F., Rodríguez-Hortalá, J., Sánchez-Hernández, J.: Rewriting and call-time choice: the HO case. In: Garrigue, J., Hermenegildo, M.V. (eds.) FLOPS 2008. LNCS, vol. 4989, pp. 147–162. Springer, Heidelberg (2008)

    Chapter  Google Scholar 

  19. López-Fraguas, F., Sánchez-Hernández, J.: \(\mathcal{TOY}\): A multiparadigm declarative system. In: Narendran, P., Rusinowitch, M. (eds.) RTA 1999. LNCS, vol. 1631, pp. 244–247. Springer, Heidelberg (1999)

    Chapter  Google Scholar 

  20. Lux, W.: Adding haskell-style overloading to curry. In: Workshop of Working Group 2.1.4 of the German Computing Science Association GI, pp. 67–76 (2008)

    Google Scholar 

  21. Martin-Martin, E.: Implementing type classes using type-indexed functions. To appear in TPF 2010 (2010), http://gpd.sip.ucm.es/enrique/publications/implementingTypeClasses/implementingTypeClasses.pdf

  22. Milner, R.: A theory of type polymorphism in programming. Journal of Computer and System Sciences 17, 348–375 (1978)

    Article  MathSciNet  MATH  Google Scholar 

  23. Moreno-Navarro, J.J., Mariño, J., del Pozo-Pietro, A., Herranz-Nieva, Á., García-Martín, J.: Adding type classes to functional-logic languages. In: Proc. APPIA-GULP-PRODE 1996, pp. 427–438 (1996)

    Google Scholar 

  24. Peyton Jones, S., Vytiniotis, D., Weirich, S.: Simple unification-based type inference for GADTs. Tech. Rep. MS-CIS-05-22, Univ. Pennsylvania (2006)

    Google Scholar 

  25. Schrijvers, T., Peyton Jones, S., Sulzmann, M., Vytiniotis, D.: Complete and decidable type inference for GADTs. In: Proc. ICFP 2009, pp. 341–352. ACM, New York (2009)

    Google Scholar 

  26. Wadler, P., Blott, S.: How to make ad-hoc polymorphism less ad hoc. In: Proc. POPL 1989, pp. 60–76. ACM, New York (1989)

    Google Scholar 

  27. Wadler, P.: Theorems for free! In: Proc. FPCA 1989, pp. 347–359. ACM, New York (1989)

    Google Scholar 

  28. Wright, A.K., Felleisen, M.: A Syntactic Approach to Type Soundness. Information and Computation 115, 38–94 (1992)

    Article  MathSciNet  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

López-Fraguas, F., Martin-Martin, E., Rodríguez-Hortalá, J. (2010). Liberal Typing for Functional Logic Programs. 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_7

Download citation

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

  • 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