Constraint-Free Type Error Slicing

  • Thomas Schilling
Part of the Lecture Notes in Computer Science book series (LNCS, volume 7193)


Type error messages for ML-based languages tend to suffer from imprecise error locations – the type checker reports only one of many possible locations of an error. The notion of a type error slice corrects this by reporting all program locations that contribute to a given error (and no more).

Previous work on producing type error slices required the use of a constraint-based type checker implementation. For most existing systems this would require substantial changes to well-tested and subtle pieces of code. In this work we show how to produce useful type error slices with an unmodified type checker. Other tools, such as automatic correction systems, can be layered on top of our system.

We have implemented this technique on top of the Glasgow Haskell Compiler (GHC) and report our experiences.


Type Variable Type Error Error Message Syntactic Category Source Program 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Damas, L., Milner, R.: Principal type-schemes for functional programs. In: POPL 1982: Proceedings of the 9th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 207–212. ACM (1982)Google Scholar
  2. 2.
    Haack, C., Wells, J.B.: Type Error Slicing in Implicitly Typed Higher-Order Languages. In: Degano, P. (ed.) ESOP 2003. LNCS, vol. 2618, pp. 284–301. Springer, Heidelberg (2003)Google Scholar
  3. 3.
    Hage, J., Heeren, B.: Heuristics for Type Error Discovery and Recovery. In: Horváth, Z., Zsók, V., Butterfield, A. (eds.) IFL 2006. LNCS, vol. 4449, pp. 199–216. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  4. 4.
    Heeren, B.J.: Top Quality Type Error Messages. Ph.D. thesis, Universiteit Utrecht (2005)Google Scholar
  5. 5.
    Lerner, B.S., Flower, M., Grossman, D., Chambers, C.: Searching for Type-Error Messages. In: Proceedings of the 2007 ACM SIGPLAN Conference on Programming Language Design & Implementation, PLDI 2007, pp. 425–434. ACM (2007)Google Scholar
  6. 6.
    Lerner, B.S., Grossman, D., Chambers, C.: Seminal: Searching for ML Type-Error Messages. In: Proceedings of the 2006 ACM SIGPLAN Workshop on ML 2006, pp. 63–73. ACM (2006)Google Scholar
  7. 7.
    Milner, R.: A Theory of Type Polymorphism in Programming. Journal of Computer and System Sciences 17, 348–375 (1978)MathSciNetzbMATHCrossRefGoogle Scholar
  8. 8.
    Pottier, F., Rémy, D.: The Essence of ML Type Inference. In: Pierce, B. (ed.) Advanced Topics in Types and Programming Languages, ch. 10, The MIT Press (2005)Google Scholar
  9. 9.
    Rahli, V., Wells, J.B., Kamareddine, F.: Challenges of a type error slicer for the SML language. Tech. rep., Heriot-Watt University, Edinburgh, UK (2009)Google Scholar
  10. 10.
    Schrijvers, T., Peyton Jones, S., Sulzmann, M., Vytiniotis, D.: Complete and Decidable Type Inference for GADTs. In: Proceedings of the 14th ACM SIGPLAN International Conference on Functional Programming, ICFP 2009, pp. 341–352. ACM (2009)Google Scholar
  11. 11.
    Stuckey, P.J., Sulzmann, M., Wazny, J.R.: Improving Type Error Diagnosis. In: Proceedings of the 2004 ACM SIGPLAN Workshop on Haskell 2004, pp. 80–91. ACM (2004)Google Scholar
  12. 12.
    Wazny, J.R.: Type inference and type error diagnosis for Hindley/Milner with extensions. Ph.D. thesis, The University of Melbourne (January 2006)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2012

Authors and Affiliations

  • Thomas Schilling
    • 1
  1. 1.School of ComputingUniversity of KentUK

Personalised recommendations