Skip to main content

Posts

Showing posts from August, 2014

Fun with Lambdas: C++14 Style (part 3)

Now that we have C++14 , it has opened up doors for truly mind-bending uses of lambdas--more specifically--generic lambdas. This blog post is the third installment in the series of "Fun with Lambdas: C++14 Style". Check out part 1 and part 2 if you have not already. This post is about "monadic tuples". Monad--a simple but powerful abstraction, however, considered quite difficult to understand in the imperative circles. We will look into what's know as the "continuation monad". As it turns out, in C++14, you need just a couple of lines of code to create an instance of a continuation monad. I'm fairly new to the world of monads. So, things did not begin with great clarity for me. It all started with an intriguing question on Stackoverflow . As it turns out the same "trick" is also used in Boost.Hana and discussed on boost mailing list here . What you see below is more or less how I came to understand the idiom as an instance ...