3 ms·
// must be overloaded template<template<typename> class M,typename T,typename F> auto operator>>=(const M<T>& m, F f)->decltype(f(std::declval<const T>()));
by rsp1984 12y ago
// must be overloaded
template<template<typename> class M,typename T,typename F>
auto operator>>=(const M<T>& m, F f)->decltype(f(std::declval<const T>()));
Could someone please point out to me why exactly this is useful and why I would want to code like this? Does it help me solve specific types of problems?
- patrick73 12y agoI think this is worth enough for intellectual practice, but honestly, I can't see how this can solve a specific type of problem.
- dkarapetyan 12y agoMonads are originally a solution to giving semantics to i/o, exceptions, and other things that fall under the generic headline of side-effecting computations. I'm not sure what value you get out of it when your language isn't Haskell. Here's the paper that started it all: http://www.cs.cmu.edu/afs/cs/user/crary/www/819-f09/Moggi91.pdf http://www.cs.cmu.edu/afs/cs/user/crary/www/819-f09/Moggi91.....
- whoopdedo 12y agoIt looks like he's using template metaprogramming so he can write C++ as if it were Haskell. So why not just use Haskell?