Re:Seemingly impossible functional programs (2007)
by lmm on Tuesday November 17, 2015 @05:00AM
(#10580114)
C++ still doesn't have (tagged) union types so you'd have to implement Maybe by hand, which is a little tedious. But I don't see anything in this code that requires laziness or the Haskell type system, so you can translate it pretty directly into pretty much any language (though as sibling mentions, in a language without TCO you might have to manually trampoline it - again tedious, and unperformant).
[ Parent
| on HN ]
Re:Seemingly impossible functional programs (2007)
by hellofunk on Tuesday November 17, 2015 @05:30AM
(#10580218)
Tagged unions are a pretty common exercise in C++, they don't require much code to implement.
As for Maybe, if it is basically an "optional" as in other languages, then the newer c++17 has <optional>, if I'm not mistaken.