Skip to main content

Partial Type Signatures for Haskell

  • Conference paper
Practical Aspects of Declarative Languages (PADL 2014)

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 8324))

Included in the following conference series:

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.

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
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

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. Bolingbroke, M.: Constraint kinds for GHC (2011), http://blog.omega-prime.co.uk/?p=127

  2. Claessen, K., Axelsson, E.: The patch-combinators package. Hackage (2012), http://hackage.haskell.org/package/patch-combinators

  3. Dijkstra, A.: Stepping Through Haskell. Ph.D. thesis, Universiteit Utrecht (2005)

    Google Scholar 

  4. Dijkstra, A., Swierstra, D.S.: Making implicit parameters explicit. Tech. Rep. UU-CS-2005-032, Universiteit Utrecht (2005)

    Google Scholar 

  5. Kiselyov, O.: Partial signatures (August 2004), http://okmij.org/ftp/Haskell/types.html#partial-sigs (visited on December 31, 2012)

  6. Leijen, D.: HMF: simple type inference for first-class polymorphism. In: ICFP, pp. 283–294. ACM (2008)

    Google Scholar 

  7. Norell, U.: Towards a practical programming language based on dependent type theory. Ph.D. thesis, Chalmers University and Göteborg University (2007)

    Google Scholar 

  8. Peyton Jones, S., Shields, M.: Lexically-scoped type variables (2004)

    Google Scholar 

  9. Peyton Jones, S., Vytiniotis, D., Weirich, S., Shields, M.: Practical type inference for arbitrary-rank types. J. Funct. Program. 17(1), 1–82 (2007)

    Article  MATH  MathSciNet  Google Scholar 

  10. Rémy, D.: Simple, partial type-inference for System F based on type-containment. In: ICFP, pp. 130–143. ACM (2005)

    Google Scholar 

  11. Sulzmann, M., Wazny, J.: Lexically scoped type annotations (2005) (manuscript), http://www.cs.mu.oz.au/~sulzmann/manuscript/lexical-annot.ps

  12. Various authors: Infer type context in a type signature. GHC Ticket (2011), http://hackage.haskell.org/trac/ghc/ticket/5248

  13. 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)

    Article  MATH  MathSciNet  Google Scholar 

  14. Wallace, M.: Partial type signatures/annotations. Haskell Prime Wiki (February 2006), http://ghc.haskell.org/trac/haskell-prime/wiki/PartialTypeAnnotations

  15. Wallace, M., et al.: Partial type signatures. Haskell Prime Wiki (January 2006), http://ghc.haskell.org/trac/haskell-prime/wiki/PartialTypeSigs

  16. Wazny, J.: Type inference and type error diagnosis for Hindley/Milner with extensions. Ph.D. thesis, University of Melbourne (2006)

    Google Scholar 

  17. 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

  18. 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)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints 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)

Publish with us

Policies and ethics