Type Class Directives

  • Bastiaan Heeren
  • Jurriaan Hage
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3350)

Abstract

The goal of this paper is to improve the type error messages in the presence of Haskell 98 type classes, in particular for the non-expert user. As a language feature, type classes are very pervasive, and strongly influence what is reported and when, even in relatively simple programs. We propose four type class directives, and specialized type rules, to lend high-level support to compilers to improve the type error messages. Both have been implemented, and can be used to easily modify the behavior of the type inference process.

Keywords

type error messages type classes directives domain-specific programming 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    McAdam, B.: How to repair type errors automatically. In: 3rd Scottish Workshop on Functional Programming, Stirling, U.K., pp. 121–135 (2001)Google Scholar
  2. 2.
    Yang, J., Michaelson, G., Trinder, P.: Explaining polymorphic types. The Computer Journal 45, 436–452 (2002)MATHCrossRefGoogle Scholar
  3. 3.
    Haack, C., Wells, J.B.: Type error slicing in implicitly typed higher-order languages. In: Proceedings of the 12th European Symposium on Programming, pp. 284–301 (2003)Google Scholar
  4. 4.
    Stuckey, P., Sulzmann, M., Wazny, J.: Interactive type debugging in Haskell. In: Haskell Workshop, pp. 72–83. ACM Press, New York (2003)CrossRefGoogle Scholar
  5. 5.
    Peyton Jones, S. (ed.): Haskell 98 Language and Libraries: The Revised Report. Cambridge University Press, Cambridge (2003), http://www.haskell.org/onlinereport/ Google Scholar
  6. 6.
    Heeren, B., Hage, J., Swierstra, S.D.: Scripting the type inference process. In: Eighth ACM Sigplan International Conference on Functional Programming, pp. 3–13. ACM Press, New York (2003)CrossRefGoogle Scholar
  7. 7.
    Heeren, B., Leijen, D., van IJzendoorn, A.: Helium, for learning Haskell. In: ACM Sigplan 2003 Haskell Workshop, pp. 62–71. ACM Press, New York (2003), http://www.cs.uu.nl/helium CrossRefGoogle Scholar
  8. 8.
    Jones, M.P.: Simplifying and improving qualified types. In: International Conference on Functional Programming Languages and Computer Architecture, pp. 160–169 (1995)Google Scholar
  9. 9.
    Milner, R.: A theory of type polymorphism in programming. Journal of Computer and System Sciences 17, 348–375 (1978)MATHCrossRefMathSciNetGoogle Scholar
  10. 10.
    Jones, M.P.: Typing Haskell in Haskell. In: Haskell Workshop (1999)Google Scholar
  11. 11.
    Wand, M.: Finding the source of type errors. In: Conference Record of the 13th Annual ACM Symposium on Principles of Programming Languages, St. Petersburg, FL, pp. 38–43 (1986)Google Scholar
  12. 12.
    Walz, J.A., Johnson, G.F.: A maximum flow approach to anomaly isolation in unification-based incremental type inference. In: Conference Record of the 13th Annual ACM Symposium on Principles of Programming Languages, St. Petersburg, FL, pp. 44–57 (1986)Google Scholar
  13. 13.
    Shields, M., Peyton Jones, S.: Object-oriented style overloading for Haskell. In: Workshop on Multi-Language Infrastructure and Interoperability, BABEL 2001 (2001)Google Scholar
  14. 14.
    Glynn, K., Stuckey, P., Sulzmann, M.: Type classes and constraint handling rules. In: First Workshop on Rule-Based Constraint Reasoning and Programming (2000)Google Scholar
  15. 15.
    Findler, R.B., Clements, J., Cormac Flanagan, M.F., Krishnamurthi, S., Steckler, P., Felleisen, M.: DrScheme: A programming environment for Scheme. Journal of Functional Programming 12, 159–182 (2002)MATHCrossRefGoogle Scholar
  16. 16.
    Peyton Jones, S., Jones, M., Meijer, E.: Type classes: an exploration of the design space. In: Haskell Workshop (1997)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2005

Authors and Affiliations

  • Bastiaan Heeren
    • 1
  • Jurriaan Hage
    • 1
  1. 1.Institute of Information and Computing SciencesUtrecht UniversityUtrechtThe Netherlands

Personalised recommendations