Type-based cost analysis for lazy functional languages
MetadataShow full item record
We present a static analysis for determining the execution costs of lazily evaluated functional languages, such as Haskell. Time- and space-behaviour of lazy functional languages can be hard to predict, creating a significant barrier to their broader acceptance. This paper applies a type-based analysis employing amortisation and cost effects to statically determine upper bounds on evaluation costs. While amortisation performs well with finite recursive data, we significantly improve the precision of our analysis for co-recursive programs (i.e. dealing with potentially infinite data structures) by tracking self-references. Combining these two approaches gives the first automatic static analysis for both recursive and co-recursive definitions. Furthermore, we generalize the analysis to determine cost bounds for an arbitrary measure assigned to syntactic constructs (e.g. evaluation steps, applications, allocations, etc.). Notably, automatic inference only relies on first-order unification and linear programming solving. Our publicly available implementation demonstrates the practicability of our technique on editable non-trivial examples.
Jost , S , Vasconcelos , P , Florido , M & Hammond , K 2017 , ' Type-based cost analysis for lazy functional languages ' Journal of Automated Reasoning , vol. 59 , no. 1 , pp. 87-120 . https://doi.org/10.1007/s10817-016-9398-9
Journal of Automated Reasoning
© 2017, Springer Science+Business Media Dortrecht. This work has been made available online in accordance with the publisher’s policies. This is the author created, accepted version manuscript following peer review and may differ slightly from the final published version. The final published version of this work is available at link.springer.com / https://doi.org/10.1007/s10817-016-9398-9
Items in the St Andrews Research Repository are protected by copyright, with all rights reserved, unless otherwise indicated.