PLDI '88 Proceedings of the ACM SIGPLAN 1988 conference on Programming Language design and Implementation
Dynamic typing in a statically typed language
ACM Transactions on Programming Languages and Systems (TOPLAS)
Proceedings of the fourth ACM SIGPLAN international conference on Functional programming
Proceedings of the seventh ACM SIGPLAN international conference on Functional programming
A lightweight implementation of generics and dynamics
Proceedings of the 2002 ACM SIGPLAN workshop on Haskell
Generic Programming within Dependently Typed Programming
Proceedings of the IFIP TC2/WG2.1 Working Conference on Generic Programming
IFL '96 Selected Papers from the 8th International Workshop on Implementation of Functional Languages
First-order unification by structural recursion
Journal of Functional Programming
Haskell '04 Proceedings of the 2004 ACM SIGPLAN workshop on Haskell
Simple unification-based type inference for GADTs
Proceedings of the eleventh ACM SIGPLAN international conference on Functional programming
Meta-programming With Built-in Type Equality
Electronic Notes in Theoretical Computer Science (ENTCS)
Proceedings of the 13th ACM SIGPLAN international conference on Functional programming
Type checking with open type functions
Proceedings of the 13th ACM SIGPLAN international conference on Functional programming
Unembedding domain-specific languages
Proceedings of the 2nd ACM SIGPLAN symposium on Haskell
Dependently typed programming in Agda
AFP'08 Proceedings of the 6th international conference on Advanced functional programming
Ad-hoc polymorphism and dynamic typing in a statically typed functional language
Proceedings of the 6th ACM SIGPLAN workshop on Generic programming
iTasks for a change: type-safe run-time change in dynamically evolving workflows
Proceedings of the 20th ACM SIGPLAN workshop on Partial evaluation and program manipulation
A functional shell that operates on typed and compiled applications
AFP'04 Proceedings of the 5th international conference on Advanced Functional Programming
Hi-index | 0.00 |
Dynamic typing in a statically typed functional language allows us to defer type unification until run time. This is typically useful when interacting with the 'outside' world where the type of values involved may not be known statically. Haskell has minimal support for dynamic typing, it only supports monomorphism. Clean, on the other hand, has a more rich and mature dynamic typing system where polymorphism is supported as well. An interesting difference is that Haskell offers monomorphic dynamic typing via a library, while Clean offers polymorphic dynamic typing via built-in language support. In the Clean approach there is a great deal of freedom in the implementation in the compiler since the dynamic typing system is defined on abstract syntax trees, whereas the Haskell approach does not need to extend the core language and hence reduces the complexity of the language and compiler. In this paper we investigate what it takes for a functional language to embed polymorphic dynamic typing. We explore an embedding in Haskell using generalised algebraic datatypes and argue that a universe for the representation of types needs to separated from its interpretation as a type. We motivate the need for a dependently-typed functional language like Agda and perform the embedding using structural equality on type representations. Finally, we extend this approach with an instance-of algorithm and define a framework for the corresponding cast function.