Live data from Hacker News

A workshop on monads with C++14

github.com

1–9 of 9 posts

Re: A workshop on monads with C++14

#4
post #3

And the award for least descriptive commit log of all time goes to... Cool stuff though.

Eh, when you're doing writing rather than coding, sometimes it's hard to be more descriptive than "added more text." I have a few repositories where I don't care much about the "logic" of the history, but I just want things versioned. (e.g. a folder full of text files with random ideas jotted down.) My commit commands tend to look like,

    git commit -m "`date`"

Re: A workshop on monads with C++14

#5

  // must be overloaded
  template class M,typename T,typename F>
  auto operator>>=(const M& m, F f)->decltype(f(std::declval()));
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?

Re: A workshop on monads with C++14

#6
post #5

// must be overloaded template class M,typename T,typename F> auto operator>>=(const M & m, F f)->decltype(f(std::declval ())); 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?

I think this is worth enough for intellectual practice, but honestly, I can't see how this can solve a specific type of problem.

Re: A workshop on monads with C++14

#7
post #5

// must be overloaded template class M,typename T,typename F> auto operator>>=(const M & m, F f)->decltype(f(std::declval ())); 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?

Monads 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.....

Re: A workshop on monads with C++14

#9
post #5

// must be overloaded template class M,typename T,typename F> auto operator>>=(const M & m, F f)->decltype(f(std::declval ())); 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?

It looks like he's using template metaprogramming so he can write C++ as if it were Haskell.

So why not just use Haskell?