Saint: An API-Generic Type-Safe Interpreter

Typed functional programming allows us to write interesting programs without sacrificing type safety. Programs that expose their API to an open world, however, are faced with the problem of dynamic type checking. In Haskell, existing techniques that address this problem, such as Typeable and Dynamic, are often closed and difficult to extend. We have constructed an extensible Haskell library for describing APIs using annotated type representations. As a result, API calls can be interpreted in a type-safe manner without extra programming effort. In addition, the user has full control over the universe of allowed types, which helps to catch misconceptions in an early stage. We have applied our technique to connect a real-world DSL (GRACe) to a JavaScript GUI.

[1]  Stephanie Weirich,et al.  Dependently typed programming with singletons , 2013, Haskell '12.

[2]  Wouter Swierstra,et al.  Data types à la carte , 2008, Journal of Functional Programming.

[3]  Johan Jeuring,et al.  Specifying Rewrite Strategies for Interactive Exercises , 2010, Math. Comput. Sci..

[4]  Peter Henderson Functional geometry , 1982, LFP '82.

[5]  S. Doaitse Swierstra,et al.  Typing dynamic typing , 2002, ICFP '02.

[6]  James Cheney,et al.  A lightweight implementation of generics and dynamics , 2002, Haskell '02.

[7]  Patrick Bahr,et al.  Compositional data types , 2011, WGP@ICFP.

[8]  Simon L. Peyton Jones,et al.  Scrap your boilerplate: a practical design pattern for generic programming , 2003, TLDI '03.

[9]  Andres Löh,et al.  Type-level web APIs with Servant: an exercise in domain-specific generic programming , 2015, WGP@ICFP.

[10]  Zoltán Horváth,et al.  Feldspar: A domain specific language for digital signal processing algorithms , 2010, Eighth ACM/IEEE International Conference on Formal Methods and Models for Codesign (MEMOCODE 2010).

[11]  Ralf Hinze,et al.  Typed Contracts for Functional Programming , 2006, FLOPS.

[12]  Oleg Kiselyov,et al.  Typed Tagless Final Interpreters , 2010, SSGIP.

[13]  Simon L. Peyton Jones,et al.  A Reflection on Types , 2016, A List of Successes That Can Change the World.

[14]  Robin Milner,et al.  Principal type-schemes for functional programs , 1982, POPL '82.