Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
research-article

Hasochism: the pleasure and pain of dependently typed haskell programming

Published: 23 September 2013 Publication History
  • Get Citation Alerts
  • 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.
    [2]
    W. Aitken and J. Reppy. Abstract value constructors. Technical Report TR 92--1290, Cornell University, 1992.
    [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.
    [4]
    E. Brady. Practical Implementation of a Dependently Typed Functional Programming Language. PhD thesis, University of Durham, 2005.
    [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.
    [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.
    [7]
    R. A. Eisenberg and S. Weirich. Dependently typed programming with singletons. In Haskell, pages 117--130. ACM, 2012.
    [8]
    G. P. Huet. The Zipper. J. Funct. Program., 7 (5): 549--554, 1997.
    [9]
    O. Kiselyov and C.-c. Shan. Lightweight static resources: Sexy types for embedded and systems programming. In TFP, 2007.
    [10]
    J. P. Magalhães. The right kind of generic programming. In WGP, pages 13--24. ACM, 2012.
    [11]
    C. McBride. A Case For Dependent Families. Seminar at LFCS, Edinburgh. http://www.strictlypositive.org/a-case/, 2000.
    [12]
    C. McBride. Kleisli arrows of outrageous fortune, 2011. Accepted for publication.\ https://personal.cis.strath.ac.uk/conor.mcbride/Kleisli.pdf.
    [13]
    C. McBride. The Strathclyde Haskell Enhancement. https://personal.cis.strath.ac.uk/conor.mcbride/pub/she/, 2013.
    [14]
    C. McBride and J. McKinna. The view from the left. J. Funct. Program., 14 (1): 69--111, 2004.
    [15]
    C. McBride and R. Paterson. Applicative programming with effects. J. Funct. Program., 18 (1): 1--13, 2008.
    [16]
    R. Milner. A theory of type polymorphism in programming. J. Comput. Syst. Sci., 17 (3): 348--375, 1978.
    [17]
    R. Milner, M. Tofte, and R. Harper. The Definition of standard ML. MIT Press, 1990.
    [18]
    A. Miquel. The implicit calculus of constructions. In TLCA, LNCS, pages 344--359. Springer, 2001.
    [19]
    S. Monnier and D. Haguenauer. Singleton types here, singleton types there, singleton types everywhere. In PLPV, pages 1--8. ACM, 2010.
    [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.
    [21]
    C. Paulin-Mohring. Extracting Fω's programs from proofs in the Calculus of Constructions. In POPL. ACM, 1989.
    [22]
    R. Pollack. Implicit syntax. Informal Proceedings of First Workshop on Logical Frameworks, Antibes, 1990.
    [23]
    J. C. Reynolds. Separation logic: A logic for shared mutable data structures. In LICS, pages 55--74. IEEE Computer Society, 2002.
    [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.
    [25]
    P. Wadler and S. Blott. How to make ad-hoc polymorphism less ad-hoc. In POPL, pages 60--76. ACM, 1989.
    [26]
    S. Weirich, J. Hsu, and R. A. Eisenberg. Towards dependently typed Haskell: System FC with kind equality. In ICFP. ACM, 2013.
    [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.

    Cited By

    View all
    • (2020)Strong functional pearl: Harper’s regular-expression matcher in CedilleProceedings of the ACM on Programming Languages10.1145/34090044:ICFP(1-25)Online publication date: 3-Aug-2020
    • (2019)Music as language: putting probabilistic temporal graph grammars to good useProceedings of the 7th ACM SIGPLAN International Workshop on Functional Art, Music, Modeling, and Design10.1145/3331543.3342576(1-10)Online publication date: 23-Aug-2019
    • (2017)Type-and-scope safe programs and their proofsProceedings of the 6th ACM SIGPLAN Conference on Certified Programs and Proofs10.1145/3018610.3018613(195-207)Online publication date: 16-Jan-2017
    • Show More Cited By

    Recommendations

    Comments

    Information & Contributors

    Information

    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
    Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    Published: 23 September 2013
    Published in SIGPLAN Volume 48, Issue 12

    Check for updates

    Author Tags

    1. data type promotion
    2. dependent types
    3. invariants
    4. proof search
    5. singletons

    Qualifiers

    • Research-article

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)27
    • Downloads (Last 6 weeks)1

    Other Metrics

    Citations

    Cited By

    View all
    • (2020)Strong functional pearl: Harper’s regular-expression matcher in CedilleProceedings of the ACM on Programming Languages10.1145/34090044:ICFP(1-25)Online publication date: 3-Aug-2020
    • (2019)Music as language: putting probabilistic temporal graph grammars to good useProceedings of the 7th ACM SIGPLAN International Workshop on Functional Art, Music, Modeling, and Design10.1145/3331543.3342576(1-10)Online publication date: 23-Aug-2019
    • (2017)Type-and-scope safe programs and their proofsProceedings of the 6th ACM SIGPLAN Conference on Certified Programs and Proofs10.1145/3018610.3018613(195-207)Online publication date: 16-Jan-2017
    • (2024)Deriving Dependently-Typed OOP from First PrinciplesProceedings of the ACM on Programming Languages10.1145/36498468:OOPSLA1(983-1009)Online publication date: 29-Apr-2024
    • (2021)Deadlock-free session types in linear HaskellProceedings of the 14th ACM SIGPLAN International Symposium on Haskell10.1145/3471874.3472979(1-13)Online publication date: 18-Aug-2021
    • (2020)Eliminating bugs with dependent Haskell (experience report)Proceedings of the 13th ACM SIGPLAN International Symposium on Haskell10.1145/3406088.3409020(9-16)Online publication date: 27-Aug-2020
    • (2020)Stitch: the sound type-indexed type checker (functional pearl)Proceedings of the 13th ACM SIGPLAN International Symposium on Haskell10.1145/3406088.3409015(39-53)Online publication date: 27-Aug-2020
    • (2019)Multi-Label Punitive kNN with Self-Adjusting Memory for Drifting Data StreamsACM Transactions on Knowledge Discovery from Data10.1145/336357313:6(1-31)Online publication date: 11-Nov-2019
    • (2019)Lambda: the ultimate sublanguage (experience report)Proceedings of the ACM on Programming Languages10.1145/33427133:ICFP(1-17)Online publication date: 26-Jul-2019
    • (2019)Dependently typed Haskell in industry (experience report)Proceedings of the ACM on Programming Languages10.1145/33417043:ICFP(1-16)Online publication date: 26-Jul-2019
    • Show More Cited By

    View Options

    Get Access

    Login options

    View options

    PDF

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Media

    Figures

    Other

    Tables

    Share

    Share

    Share this Publication link

    Share on social media