It's an interesting approach. Your Then constructor maps to my Bind object more naturally than >>= does. 

The main reason for using objects rather than functions (closures) in C++ is that the compiler may be able to optimize/inline more code. Closures are not first class citizens in C++ -- they cannot be returned from functions or stored in variables without being converted to clunky std::function.

BTW, I'm studying your reactive banana library trying to learn more about FRP. 

--Bartosz

On Thursday, June 21, 2012 9:21:34 AM UTC-7, Heinrich Apfelmus wrote:
Bartosz Milewski wrote:
> I published a blog for C++ programmers about the advantages of using the
> continuation monad in dealing with asynchronous API, concurrency, and
> parallelism. I explained the concepts in Haskell and the translated them
> into C++.
> http://fpcomplete.com/asynchronous-api-in-c-and-the-continuation-monad/

I always found the continuation monad to be hard to understand. An
easier yet equivalent approach is presented in my "Operational Monad
Tutorial" [1].

   [1]: http://themonadreader.wordpress.com/2010/01/26/issue-15/
   [2]: http://www.haskell.org/haskellwiki/Operational


Best regards,
Heinrich Apfelmus

--
http://apfelmus.nfshost.com


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe