Foreign Exchange at Low, Low Rates
Paper in proceedings, 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.




functional programming


Anton Ekblad

Chalmers, Computer Science and Engineering (Chalmers), Software Technology (Chalmers)

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

Vol. 2015 2897338

Areas of Advance

Information and Communication Technology

Subject Categories

Software Engineering





More information