Multi-Language Library Development. From Haskell Type Classes to C++ Concepts.
Paper in proceeding, 2007

We define a mapping from generic Haskell specifications to C++ with concepts, a recent extension to C++, that can ultimately be automated. More specifically, we provide a translation from Haskell multi-parameter type classes with functional dependencies to ConceptC++. Our translation consists of three major parts: the division of Haskell class variables into ConceptC++ concept parameters and associated types, the corresponding division of superclasses in the context of a type class, and the linearization of Haskell ASTs to the concrete syntax of ConceptC++. We also discuss cases in which there is no single correct translation from classes with functional dependencies to concepts. Our translation handles these cases in a reasonable way and is well-defined for the cases most common in practice. The translation is motivated by an ongoing project for distributed adaptive finite volume methods, in which software components are modeled in Haskell and implemented in C++.

Type classes

translation

C++

concepts

Author

Marcin Zalewski

Chalmers, Computer Science and Engineering (Chalmers), Computing Science (Chalmers)

Andreas Priesnitz

Chalmers, Computer Science and Engineering (Chalmers), Computing Science (Chalmers)

Cezar Ionescu

Nicola Botta

Sibylle Schupp

Chalmers, Computer Science and Engineering (Chalmers), Computing Science (Chalmers)

Multiparadigm Programming with Object-Oriented Languages, an ECOOP workshop

Subject Categories

Software Engineering

Computer Science

More information

Created

10/8/2017