I've been following your blog for a while and I completely agree with the message about the connection of functional programming and C++ template metaprograms.

At Eötvös Loránd University, Budapest there is a research group working with template metaprograms since 2003. The group has implemented template metaprogram debugger and visualization tool and a few other applications. The long term goal is writing metaprograms in Haskell, transforming them into C++ in automated way and keep C++ syntax only as a kind of assembly of metaprograms.

As a part of this effort, I've written a template metaprogramming parser generator library (http://abel.sinkovics.hu/?mod=kutat) which can parse a text at C++ compilation time. It can be used to implement domain specific languages in C++ without external tools. You can do really cool things using it, but error messages provided by the parsers built with my library are not really usable.

Due to the connection between functional programming and C++ template metaprogramming, I've been trying to improve the error messages using monads. I've been playing with monads in C++ template metaprograms and I'm building something similar to Haskell's do-syntax for template metaprogramming. The plan is to use that syntax for parser construction. I already have some parts working, with my current implementation you can write things like:

struct x;

template <.....>
struct my_metafunction_using_do_syntax :
  DO<
    SET<x, .....>,
    CALL<some_other_metafunction, x>
  >
{};

You can find my code here: https://github.com/sabel83/mpllibs I recommend looking at the unit tests for my do-syntax implementation to see it in action: src/lib/mpllibs/error/test/do_.cpp

Note that the monadic part is not documented yet, since it is still work in progress. I'm curious about other uses of monads in C++ template metaprogramming.