ABSTRACT
As a functional pearl, we describe an efficient, modularized implementation of unification using the state of mutable reference cells to encode substitutions. We abstract our algorithms along two dimensions, first abstracting away from the structure of the terms to be unified, and second over the monad in which the mutable state is encapsulated. We choose this example to illustrate two important techniques that we believe many functional programmers would find useful. The first of these is the definition of recursive data types using two levels: a structure defining level, and a recursive knot-tying level. The second is the use of rank-2 polymorphism inside Haskell's record types to implement a form of type parameterized modules.
- L. Cardelli. Basic polymorphic typechecking.Scuence of Computer Programinvag, 8(2):117172, Apr. 1987.]] Google ScholarDigital Library
- R. Harper and M. Lillibridge. A type-theoretic approach to higher-order modules with sharing. In ACM, editor, Confe,tnce record of POPL '94, 21st ACM SJC1'LAIVSIGACT Symposium on Prtiezples of Programming Languages: papers presented at the Symposium: Portland. Oregon, January 17-21, 1994, pages 123-137. New York. NY, USA, 1994. ACM Press.]] Google ScholarDigital Library
- R. Harper and B. C. Pierce. Advanced module systems (invited talk): a guide for the perplexed. ACM SIGPLAN Notices. 35(9):130-130, Sept. 2000.]] Google ScholarDigital Library
- R. Hinze. Memo functions, polytypically! In J. Jeuring, editor, Proceedings 2nd Workshop on Generic Programming. WCP'2000, Ponte de Lima. Portugal, 6 July 2000, Tech. Report UU-CS2000-19. Dept. of Computer Science, Utrecht Univ., pages 17 32. June 2000.]]Google Scholar
- R. Hinze. A new approach to generic functional programming. In Proceedings of the 27th ACM SIGPLAN-SIGACI' Symposium on Principles of Programming Languages (POLP-00), pages 119-132, N.Y., Jan. 19-21 2000. ACM Press.]] Google ScholarDigital Library
- P. Jansson and J. Jeuring. Polyp - a polytypic programming language extension. In ACM. editor. Conference record of POPL 97 the 24th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages: papers presented at the symposium. Paris, France, 15-17 January 1997. pages 470-482, New York, NY. USA, 1997. ACM Press.]] Google ScholarDigital Library
- P. Jansson and J. Jeuring. Functional pearl: Polytypie unification. Journal of Functional Programming, 8(5):527-536. Sept. 1998.]] Google ScholarDigital Library
- J. Jeuring and P. Jansson. Polytypic programming. In J. Launchbury, E. Meijer, and T. Sheard, editors. Tutorial Text 2nd Int. School on Advanced Functional Programming. Olympia, WA, USA, 26-30 Aug 1996. volume 1129 of Lecture Notes in Computer Science, pages 68-114. Springer-Verlag, Berlin, 1996.]] Google ScholarDigital Library
- M. Jones. Type classes and functional dependencies. In Proceedings of the 9th European Symposium on Programming. ESOP 2000, volume LNCS 1782. Springer-Verlag. March 2000.]] Google ScholarDigital Library
- M. P. Jones. Using parameterized signatures to express modular structure. In 23rd ACM SJCPLAN-SIGACJ' Symposium on Principles of Programming Languages (POPL '96), pages 6878. St. Petersburg Beach, Florida, 21-24 Jan. 1996.]] Google ScholarDigital Library
- M. P. Jones. Typing haskell in haskell. In Proceedings of the 1999 Haskell Workshop. pages 68-78, Paris, France, 21-24 Oct. 1999. Published in Technical Report UU-CS-1999-28, Department of Computer Science, University of Utrecht.]]Google Scholar
- J. Launchbury and S. Peyton-Jones. Lazy functional state threads. In PLDI'94: Programming Language Design and Implementation, Orlando, Florida, pages 24-35, New York, June 1994. ACM Press.]] Google ScholarCross Ref
- M. Odersky and K. Lufer. Putting type annotations to work. In ACM, editor, Conference record of POLL '96, 23rd ACM SIGPLAN-SICACJ' Symposium on Principles of Programming Languages: papers presented at the Symposium: St. Petersburg Beach, Florida, 21-24 January 1996, pages 5467, New York, NY, USA, 1996. ACM Press.]] Google ScholarDigital Library
Index Terms
- Generic unification via two-level types and parameterized modules
Recommendations
Generic unification via two-level types and parameterized modules
As a functional pearl, we describe an efficient, modularized implementation of unification using the state of mutable reference cells to encode substitutions. We abstract our algorithms along two dimensions, first abstracting away from the structure of the ...
Gradual typing with unification-based inference
DLS '08: Proceedings of the 2008 symposium on Dynamic languagesStatic and dynamic type systems have well-known strengths and weaknesses. Gradual typing provides the benefits of both in a single language by giving the programmer control over which portions of the program are statically checked based on the presence ...
Range parameterized types: use-site variance without the existential questions
FTfJP '09: Proceedings of the 11th International Workshop on Formal Techniques for Java-like ProgramsUse-site variance approaches such as Java wildcards allows to flexibly derive many co- and contravariant types from one generic class definition. Safety is achieved by restricting the access to members of the parameterized types, but the definition of ...
Comments