Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
A workshop on monads with C++14 (github.com/joaquintides)
44 points by adamnemecek on Jan 17, 2015 | hide | past | favorite | 7 comments


  // 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?


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


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

So why not just use Haskell?


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`"


Template template templates. I didn't know that was thing.


C++ repeats itself, first as tragedy, then as farce.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: