skip to main content
research-article

Hasochism: the pleasure and pain of dependently typed haskell programming

Published:23 September 2013Publication History
Skip Abstract Section

Abstract

Haskell's type system has outgrown its Hindley-Milner roots to the extent that it now stretches to the basics of dependently typed programming. In this paper, we collate and classify techniques for programming with dependent types in Haskell, and contribute some new ones. In particular, through extended examples---merge-sort and rectangular tilings---we show how to exploit Haskell's constraint solver as a theorem prover, delivering code which, as Agda programmers, we envy. We explore the compromises involved in simulating variations on the theme of the dependent function space in an attempt to help programmers put dependent types to work, and to inform the evolving language design both of Haskell and of dependently typed languages more broadly.

References

  1. A. Abel and G. Scherer. On irrelevance and algorithmic equality in predicative type theory. Logical Methods in Computer Science, 8 (1), 2012.Google ScholarGoogle Scholar
  2. W. Aitken and J. Reppy. Abstract value constructors. Technical Report TR 92--1290, Cornell University, 1992.Google ScholarGoogle Scholar
  3. B. Barras and B. Bernardo. The implicit calculus of constructions as a programming language with dependent types. In FoSSaCS, volume 4962 of LNCS, pages 365--379, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. E. Brady. Practical Implementation of a Dependently Typed Functional Programming Language. PhD thesis, University of Durham, 2005.Google ScholarGoogle Scholar
  5. E. Brady, C. McBride, and J. McKinna. Inductive families need not store their indices. In TYPES, volume 3085 of LNCS, pages 115--129. Springer, 2003.Google ScholarGoogle Scholar
  6. S. Cui, K. Donnelly, and H. Xi. ATS: A language that combines programming with theorem proving. In FroCoS, volume 3717 of LNCS, pages 310--320. Springer, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. R. A. Eisenberg and S. Weirich. Dependently typed programming with singletons. In Haskell, pages 117--130. ACM, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. G. P. Huet. The Zipper. J. Funct. Program., 7 (5): 549--554, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. O. Kiselyov and C.-c. Shan. Lightweight static resources: Sexy types for embedded and systems programming. In TFP, 2007.Google ScholarGoogle Scholar
  10. J. P. Magalhães. The right kind of generic programming. In WGP, pages 13--24. ACM, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. C. McBride. A Case For Dependent Families. Seminar at LFCS, Edinburgh. http://www.strictlypositive.org/a-case/, 2000.Google ScholarGoogle Scholar
  12. C. McBride. Kleisli arrows of outrageous fortune, 2011. Accepted for publication.\ https://personal.cis.strath.ac.uk/conor.mcbride/Kleisli.pdf.Google ScholarGoogle Scholar
  13. C. McBride. The Strathclyde Haskell Enhancement. https://personal.cis.strath.ac.uk/conor.mcbride/pub/she/, 2013.Google ScholarGoogle Scholar
  14. C. McBride and J. McKinna. The view from the left. J. Funct. Program., 14 (1): 69--111, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. C. McBride and R. Paterson. Applicative programming with effects. J. Funct. Program., 18 (1): 1--13, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. R. Milner. A theory of type polymorphism in programming. J. Comput. Syst. Sci., 17 (3): 348--375, 1978.Google ScholarGoogle ScholarCross RefCross Ref
  17. R. Milner, M. Tofte, and R. Harper. The Definition of standard ML. MIT Press, 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. A. Miquel. The implicit calculus of constructions. In TLCA, LNCS, pages 344--359. Springer, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. S. Monnier and D. Haguenauer. Singleton types here, singleton types there, singleton types everywhere. In PLPV, pages 1--8. ACM, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. U. Norell. Towards a practical programming language based on dependent type theory. PhD thesis, Department of Computer Science and Engineering, Chalmers University of Technology, September 2007.Google ScholarGoogle Scholar
  21. C. Paulin-Mohring. Extracting Fω's programs from proofs in the Calculus of Constructions. In POPL. ACM, 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. R. Pollack. Implicit syntax. Informal Proceedings of First Workshop on Logical Frameworks, Antibes, 1990.Google ScholarGoogle Scholar
  23. J. C. Reynolds. Separation logic: A logic for shared mutable data structures. In LICS, pages 55--74. IEEE Computer Society, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. M. Sulzmann, M. M. T. Chakravarty, S. L. P. Jones, and K. Donnelly. System F with type equality coercions. In TLDI, pages 53--66. ACM, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. P. Wadler and S. Blott. How to make ad-hoc polymorphism less ad-hoc. In POPL, pages 60--76. ACM, 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. S. Weirich, J. Hsu, and R. A. Eisenberg. Towards dependently typed Haskell: System FC with kind equality. In ICFP. ACM, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. B. A. Yorgey, S. Weirich, J. Cretin, S. L. Peyton Jones, D. Vytiniotis, and J. P. Magalhães. Giving Haskell a promotion. In TLDI, pages 53--66. ACM, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Hasochism: the pleasure and pain of dependently typed haskell programming

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in

      Full Access

      • Published in

        cover image ACM SIGPLAN Notices
        ACM SIGPLAN Notices  Volume 48, Issue 12
        Haskell '13
        December 2013
        149 pages
        ISSN:0362-1340
        EISSN:1558-1160
        DOI:10.1145/2578854
        Issue’s Table of Contents
        • cover image ACM Conferences
          Haskell '13: Proceedings of the 2013 ACM SIGPLAN symposium on Haskell
          September 2013
          158 pages
          ISBN:9781450323833
          DOI:10.1145/2503778

        Copyright © 2013 ACM

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 23 September 2013

        Check for updates

        Qualifiers

        • research-article

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader
      About Cookies On This Site

      We use cookies to ensure that we give you the best experience on our website.

      Learn more

      Got it!