skip to main content
research-article

Generative type abstraction and type-level computation

Published:26 January 2011Publication History
Skip Abstract Section

Abstract

Modular languages support generative type abstraction, ensuring that an abstract type is distinct from its representation, except inside the implementation where the two are synonymous. We show that this well-established feature is in tension with the non-parametric features of newer type systems, such as indexed type families and GADTs. In this paper we solve the problem by using kinds to distinguish between parametric and non-parametric contexts. The result is directly applicable to Haskell, which is rapidly developing support for type-level computation, but the same issues should arise whenever generativity and non-parametric features are combined.

Skip Supplemental Material Section

Supplemental Material

20-mpeg-4.mp4

References

  1. M. Benke, P. Dybjer, and P. Jansson. Universes for generic programs and proofs in dependent type theory. Nordic J. of Computing, 10(4):265--289, 2003. ISSN 1236--6064. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. A. Bove, P. Dybjer, and U. Norell. A brief overview of agda -- a functional language with dependent types. In TPHOLs '09: Proceedings of the 22nd International Conference on Theorem Proving in Higher Order Logics, pages 73--78, Berlin, Heidelberg, 2009. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. V. Breazu-Tannen, T. Coquand, C. A. Gunter, and A. Scedrov. Inheritance as implicit coercion. Information and Computation, 93:172--221, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. M. M. T. Chakravarty, G. Keller, and S. Peyton Jones. Associated type synonyms. In ICFP '05: Proceedings of the Tenth ACM SIGPLAN International Conference on Functional Programming, pages 241--253, New York, NY, USA, 2005. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. M. M. T. Chakravarty, G. Keller, S. Peyton Jones, and S. Marlow. Associated types with class. SIGPLAN Not., 40(1):1--13, 2005b. ISSN 0362--1340. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. J.Chapman,P.Evariste Dagand,C.McBride,and P.Morris.The gentleart of levitation. In Proceedings of the Fifteenth ACM SIGPLAN International Conference on Functional Programming (ICFP '10), Baltimore, MD, USA, September 2010. To appear. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. J. Cheney and R. Hinze. First-class phantom types. CUCIS TR2003--1901, Cornell University, 2003.Google ScholarGoogle Scholar
  8. R. L. Constable. Intensional analysis of functions and types. Technical Report CSR-118--82, Department of Computer Science, University of Edinburgh, June 1982.Google ScholarGoogle Scholar
  9. R. L. Constable and D. R. Zlatin. The type theory of PL/CV3. ACM Transactions on Programming Languages and Systems, 6(1):94--117, Jan. 1984. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. K. Crary and S. Weirich. Flexible type analysis. In Proceedings of the Fourth ACM SIGPLAN International Conference on Functional Pro- gramming, pages 233--248, Paris, France, Sept. 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. N. G. de Bruijn. Telescopic mappings in typed lambda calculus. Inf. Comput., 91(2):189--204, 1991. ISSN 0890--5401. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. D. Dreyer. Recursive type generativity. In ICFP '05: Proceedings of the Tenth ACM SIGPLAN International Conference on Functional Programming, pages 41--53, New York, NY, USA, 2005. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. P. Dybjer. A general formulation of simultaneous inductive-recursive definitions in type theory. Journal of Symbolic Logic, 65(2):525--549, 2000.Google ScholarGoogle ScholarCross RefCross Ref
  14. C. V. Hall, K. Hammond, S. L. Peyton Jones, and P. L. Wadler. Type classes in Haskell. ACM Transactions on Programming Languages and Systems, 18(2):109--138, Mar. 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. R. Harper and G. Morrisett. Compiling polymorphism using intensional type analysis. In POPL '95: Proceedings of the 22nd ACM SIGPLAN-SIGACT symposium on Principles of programming languages, pages 130--141, New York, NY, USA, 1995. ACM. ISBN 0--89791--692--1. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. R. Hinze, J. Jeuring, and A. Loeh. Type-indexed data types. In B. M. Eerke Boiten, editor, Proceedings of the Sixth International Conference on Mathematics of Program Construction (MPC 2002), pages 148--174, Dagstuhl, Germany, July 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. O. Kiselyov, S. Peyton Jones, and C. Shan. Springer, 2010.Google ScholarGoogle Scholar
  18. Fun with type functions.Google ScholarGoogle Scholar
  19. D. R. Licata and R. Harper. A formulation of dependent ML with explicit equality proofs. Technical Report Carnegie Mellon University-CS-05--178, Carnegie Mellon University Department of Computer Science, 2005.Google ScholarGoogle Scholar
  20. P. Martin-Löf. An intuitionistic theory of types: Predicative part. In Proceedings of the Logic Colloquium, 1973, volume 80 of Studies in Logic and the Foundations of Mathematics, pages 73--118. North-Holland, 1975.Google ScholarGoogle Scholar
  21. R. Milner, M. Tofte, and D. Macqueen. The Definition of Standard ML. MIT Press, Cambridge, MA, USA, 1997. ISBN 0262631814. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. B. Montagu and D. Rémy.Modeling abstract types in modules with open existential types.In POPL '09: Proceedings of the 36th annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 354--365, New York, NY, USA, 2009. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. G. Neis, D. Dreyer, and A. Rossberg. Non-parametric parametricity. In ICFP '09: Proceedings of the 14th ACM SIGPLAN International Conference on Functional Programming, pages 135--148, New York, NY, USA, 2009. ACM. ISBN 978--1--60558--332--7. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. S. Peyton Jones et al. The Haskell 98 language and libraries: The revised report. Journal of Functional Programming, 13(1):0--255, Jan 2003. http://www.haskell.org/definition/. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. S. L. Peyton Jones, D. Vytiniotis, S. Weirich, and G. Washburn. Simple unification-based type inference for GADTs. In International Confer- ence on Functional Programming (ICFP), Portland, OR, USA, Sept. 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. B. C. Pierce, editor. Advanced Topics in Types and Programming Lan-guages. MIT Press, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. A. Rossberg. Dynamic translucency with abstraction kinds and higher-order coercions. Electr. Notes Theor. Comput. Sci., 218:313--336, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. A. Rossberg. Generativity and dynamic opacity for abstract types. In PPDP '03: Proceedings of the 5th ACM SIGPLAN International Conference on Principles and Practice of Declaritive Programming, pages 241--252, NewYork,NY,USA,2003.ACM.ISBN1--58113--705--2. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. C. V. Russo. Non-dependent types for Standard ML modules. In PPDP '99: Proceedings of the International Conference PPDP'99 on Principles and Practice of Declarative Programming, pages 80--97, London, UK, 1999. Springer-Verlag. ISBN 3--540--66540--4. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. T. Schrijvers, S. Peyton Jones, M. Chakravarty, and M. Sulzmann. Type checking with open type functions. In ICFP '08: Proceeding of the 13th ACM SIGPLAN international conference on Functional programming, pages 51--62, New York, NY, USA, 2008. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. Z. Shao, V. Trifonov, B. Saha, and N. Papaspyrou. A type system for certified binaries. ACM Trans. Program. Lang. Syst., 27(1):1--45, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. M. Sulzmann, M. M. T. Chakravarty, S. Peyton Jones, and K. Donnelly. System F with type equality coercions. In TLDI '07: Proceedings of the 2007 ACM SIGPLAN International Workshop on Types in Languages Design and Implementation, pages 53--66, New York, NY, USA, 2007. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. The Coq Team. Coq. URL http://coq.inria.fr.Google ScholarGoogle Scholar
  34. D. Vytiniotis, G. Washburn, and S. Weirich. An open and shut typecase. I.Google ScholarGoogle Scholar
  35. ACM SIGPLAN Workshop in Types in Language Design and Implementation, Long Beach, CA, USA, Jan. 2005.Google ScholarGoogle Scholar
  36. H. Xi, C. Chen, and G. Chen. Guarded recursive datatype constructors. In POPL, pages 224--235, 2003.. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Generative type abstraction and type-level computation

      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 46, Issue 1
        POPL '11
        January 2011
        624 pages
        ISSN:0362-1340
        EISSN:1558-1160
        DOI:10.1145/1925844
        Issue’s Table of Contents
        • cover image ACM Conferences
          POPL '11: Proceedings of the 38th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages
          January 2011
          652 pages
          ISBN:9781450304900
          DOI:10.1145/1926385

        Copyright © 2011 ACM

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 26 January 2011

        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!