Foreign Exchange at Low, Low Rates
Paper i proceeding, 2015

We present a novel yet simple foreign function interface, designed for web-targeting Haskell dialects but also applicable to a wider range of high-level target languages. The interface automates marshalling, eliminates boilerplate code, allows increased sanity checking of external data, allows the import of functions as well as arbitrary expressions of JavaScript code, and is implementable as a plain Haskell ’98 library without any modification to the Haskell compiler or environment. We give an implementation of this interface for the JavaScripttargeting Haste compiler, and show how the basic implementation can be further optimized with minimal effort to perform on par with Haskell’s vanilla foreign function interface, as well as extended to support automatic marshalling of higher-order functions and automatic marshalling of host language exceptions. We also discuss how the interface may be extended beyond the web domain and implemented across a larger range of host environments and target languages.

interoperability

compilers

web

functional programming

Författare

Anton Ekblad

Chalmers, Data- och informationsteknik, Programvaruteknik

Proceedings of the 27th Symposium on the Implementation and Application of Functional Programming Languages

Vol. 2015 2897338
978-1-4503-4273-5 (ISBN)

Styrkeområden

Informations- och kommunikationsteknik

Ämneskategorier

Programvaruteknik

DOI

10.1145/2897336.2897338

ISBN

978-1-4503-4273-5

Mer information

Skapat

2017-10-08