Polytypic data conversion programs
Science of Computer Programming
Polytypic Compact Printing and Parsing
ESOP '99 Proceedings of the 8th European Symposium on Programming Languages and Systems
A Generic Programming Extension for Clean
IFL '02 Selected Papers from the 13th International Workshop on Implementation of Functional Languages
Dependency-style generic haskell
ICFP '03 Proceedings of the eighth ACM SIGPLAN international conference on Functional programming
Type-safe, self inspecting code
Haskell '04 Proceedings of the 2004 ACM SIGPLAN workshop on Haskell
A functional shell that dynamically combines compiled code
IFL'03 Proceedings of the 15th international conference on Implementation of Functional Languages
Improved fusion for optimizing generics
PADL'05 Proceedings of the 7th international conference on Practical Aspects of Declarative Languages
The next 700 data description languages
Journal of the ACM (JACM)
Hi-index | 0.00 |
Polytypic functional programming has the advantage that it can derive code for generic functions automatically. However, it is not clear whether it is useful for anything other than the textbook examples, and the generated polytypic code is usually too slow for real-life programs. As a real-life test, we derive a polytypic parser for the Haskell 98 syntax and look into other front-end compiler syntax tree operations. We present a types–as–grammar approach, which uses polytypic programming (in both Generic Haskell and Clean) to automatically derive the code for a parser based on the syntax tree type, without using external tools. Moreover, we show that using polytypic programming can even be useful for data–specific syntax tree operations in a (functional) compiler, such as scope checking and type inference. Simple speed tests show that the performance of polytypic parsers can be abominable for real-life inputs. However, we show that much performance can be recovered by applying (extended) fusion optimization on the generated code. We actually have a derived parser whose speed is close to one generated by a specialized Haskell parser generator.