Abstract
Strong type systems can be used to increase the reliability and performance of programs. In combination with type inference the overhead for the programmer can be kept small. Nevertheless, explicit type signatures often remain needed or useful. In languages with standard Hindley-Milner-based type systems, programmers have a binary choice between omitting the type signature (and rely on type inference) or explicitly providing the type entirely; there are no intermediate options. Proposals for partial type signatures exist, but none support features like local constraints and GHC’s non-generalisation of local bindings. Therefore we propose and motivate a practical form of partial type signatures for present-day Haskell. We formally describe our proposal as an extension of the OutsideIn(X) system and prove some of its properties. We have developed a (not yet complete) implementation for the GHC Haskell compiler. Our design fits naturally in both the OutsideIn(X) formalism and the compiler.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Bolingbroke, M.: Constraint kinds for GHC (2011), http://blog.omega-prime.co.uk/?p=127
Claessen, K., Axelsson, E.: The patch-combinators package. Hackage (2012), http://hackage.haskell.org/package/patch-combinators
Dijkstra, A.: Stepping Through Haskell. Ph.D. thesis, Universiteit Utrecht (2005)
Dijkstra, A., Swierstra, D.S.: Making implicit parameters explicit. Tech. Rep. UU-CS-2005-032, Universiteit Utrecht (2005)
Kiselyov, O.: Partial signatures (August 2004), http://okmij.org/ftp/Haskell/types.html#partial-sigs (visited on December 31, 2012)
Leijen, D.: HMF: simple type inference for first-class polymorphism. In: ICFP, pp. 283–294. ACM (2008)
Norell, U.: Towards a practical programming language based on dependent type theory. Ph.D. thesis, Chalmers University and Göteborg University (2007)
Peyton Jones, S., Shields, M.: Lexically-scoped type variables (2004)
Peyton Jones, S., Vytiniotis, D., Weirich, S., Shields, M.: Practical type inference for arbitrary-rank types. J. Funct. Program. 17(1), 1–82 (2007)
Rémy, D.: Simple, partial type-inference for System F based on type-containment. In: ICFP, pp. 130–143. ACM (2005)
Sulzmann, M., Wazny, J.: Lexically scoped type annotations (2005) (manuscript), http://www.cs.mu.oz.au/~sulzmann/manuscript/lexical-annot.ps
Various authors: Infer type context in a type signature. GHC Ticket (2011), http://hackage.haskell.org/trac/ghc/ticket/5248
Vytiniotis, D., Peyton Jones, S., Schrijvers, T., Sulzmann, M.: OutsideIn(X): Modular type inference with local assumptions. J. Funct. Program. 21(4-5), 333–412 (2011)
Wallace, M.: Partial type signatures/annotations. Haskell Prime Wiki (February 2006), http://ghc.haskell.org/trac/haskell-prime/wiki/PartialTypeAnnotations
Wallace, M., et al.: Partial type signatures. Haskell Prime Wiki (January 2006), http://ghc.haskell.org/trac/haskell-prime/wiki/PartialTypeSigs
Wazny, J.: Type inference and type error diagnosis for Hindley/Milner with extensions. Ph.D. thesis, University of Melbourne (2006)
Winant, T., Devriese, D., Piessens, F., Schrijvers, T.: Partial type signatures for Haskell: Extended version with proofs of the theorems. Tech. Rep. 649, Department of Computer Science, KU Leuven (November 2013), http://www.cs.kuleuven.be/publicaties/rapporten/cw/CW649.abs.html
Yorgey, B.A., Weirich, S., Cretin, J., Peyton Jones, S., Vytiniotis, D., Magalhães, J.P.: Giving haskell a promotion. In: TLDI, pp. 53–66 (2012)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2014 Springer International Publishing Switzerland
About this paper
Cite this paper
Winant, T., Devriese, D., Piessens, F., Schrijvers, T. (2014). Partial Type Signatures for Haskell. In: Flatt, M., Guo, HF. (eds) Practical Aspects of Declarative Languages. PADL 2014. Lecture Notes in Computer Science, vol 8324. Springer, Cham. https://doi.org/10.1007/978-3-319-04132-2_2
Download citation
DOI: https://doi.org/10.1007/978-3-319-04132-2_2
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-04131-5
Online ISBN: 978-3-319-04132-2
eBook Packages: Computer ScienceComputer Science (R0)