Ábel Sinkovics: Boosting MPL with Haskell elements





The interactive transcript could not be loaded.


Rating is available when the video has been rented.
This feature is not available right now. Please try again later.
Published on Jun 10, 2013

The similarities of Haskell and C++ template metaprogramming are known [1,2], however, many elements of Haskell haven't been introduced into template
metaprogramming even though a number of them could be useful. They can extend the template metaprogramming toolset Boost.MPL provides.

Let expressions are used by a number of functional programming languages including Haskell to help making the code readable and easier to organize. They could be used in C++ template metaprogramming for the same purposes as well.

Monads together with Haskell's do notation among other things are a powerful tool for reducing the amount of boilerplate code one has to write when writing functional programs. They can be introduced in pure compile-time computations to help making the template metaprograms using them easier to read.

List comprehension helps in many programming languages making the list transformations easier to understand. As Haskell's do notation together with the List monad can be used to implement list comprehension, using the above provides this feature for template metaprogramming as well.

Error handling can be simplified by using the Either monad. By adding some syntactic sugar to it, it can be used to simulate exception handling in template metaprograms which can be understood and used by developers who don't know about monads or the way exception handling is implemented for C++ template metaprograms.

The above tools are built on top of the Boost.MPL library and can be used as an extension of it, thus they can be easily adopted by metaprograms already using Boost.MPL.

The tools presented in the talk are part of the Metamonad library, which is available at:


This is an advanced talk for users and developers. Familiarity with Boost.MPL is assumed.


When autoplay is enabled, a suggested video will automatically play next.

Up next

to add this to Watch Later

Add to

Loading playlists...