Efficient Evaluation for Untyped and Compositional Representations of Expressions
Rapport, 2014

This report gives a simple implementation of A. Baars and S.D. Swierstra's "Typing Dynamic Typing" using modern (GHC) Haskell features, and shows that the technique is especially beneficial in a compositional setting, where parts of the expression are defined separately. Evaluating expressions that are represented as algebraic data types typically requires using tagged unions to represent values. Tagged unions can introduce runtime overhead due to tag checking, and this overhead is unnecessary if the evaluated expression is well-typed. Likewise, pattern matching on the constructors of the expression causes overhead which is unnecessary if the same expression is evaluated multiple times. Typing Dynamic Typing solves both of these problems by deferring all tag checking to an initial "dynamic compilation" phase after which evaluation proceeds without any tag checking or pattern matching. The problems of tag checking and pattern matching are worse in a compositional setting, and our measurements show that the technique gives especially good performance gains for compositional expressions.


Emil Axelsson

Chalmers, Data- och informationsteknik, Programvaruteknik

Efficient and Compositional Evaluation of Untyped Expressions

Trends in Functional Programming,; (2014)

Övrigt konferensbidrag


Informations- och kommunikationsteknik



Technical report - Department of Computer Science and Engineering, Chalmers University of Technology and Göteborg University: 1652

Mer information