Facebook's New Spam-Killer Hints at the Future of Coding
wired.com
wired.com
My suspicion is that it is Haskell's great support for domain-specific languages. This is both in the sense of languages that are really "just" Haskell APIs but work in such an different manner that they are quite different, and in the sense of writing a full compiler [1] (or any subset of a compiler) for a new language.
For an example of the former, one of my favorite demonstrations is the "probability monad", in which one ends up with a sort of sublanguage inside of Haskell that is probability aware: http://www.randomhacks.net/2007/02/22/bayes-rule-and-drug-te... [2] If you want to start to really grasp the power of Haskell, you could do worse than meditate on how you'd implement that in your $FAVORITE_LANGUAGE... and then, most likely, burst into tears when someone shows you just how much of Haskell still works, unchanged, even in that environment (e.g., everything in Control.Monad), rather than having to be implemented in a parallel type hierarchy (or, put another way, producing a new "color" of functions [3]).
While I doubt they use something exactly like that, it's not hard to see how that sort of thing could make it fairly easy to write spam classification code with a lot of the basic plumbing abstracted away entirely.
There's a lot of examples of the latter, but I'm not sure of a really solid open source example to point at. I know it's a common move in industry, though.
For bonus points, these things compose together just fine; you could easily take the probability monad and build a new language on top of it.
[1]: And I do mean real compiler, by anybody's definition, all the way down to assembler if you like. Haskell's a pretty good base language for that sort thing.
[2]: Or see http://blog.plover.com/prog/haskell/probmonad-refs.html
[3]: http://journal.stuffwithstuff.com/2015/02/01/what-color-is-y...
The thing is: Biilmann no longer uses Haskell. It’s not entirely practical. Not enough people know how to use it, and this is unlikely to change. “Haskell is like a programming language from an alternate future that is never going to happen,” he says. “It solves all these problems it promises to solve. But it’s so different that there is no chance it will become common.”
1. Haskell may be a very good language to use for this particular problem set, probably better than the languages currently used for it.
2. People in general don't use Haskell and will likely resist attempts to change that.
So in theory Haskell is a good choice (because reasons) but in practise it isn't (because developers in general won't be a able to understand/maintain the resulting codebase) so he is using something else instead that avoids this problem (but he may think is a less than ideal choice in other ways).
I still have several services written in Haskell running in production and they've been rock solid for years now.
For the kind of problems I used to solve with Haskell (typically tasks involving a bunch of concurrency and IO) I use Go now. Not because it's a better language, but because Haskell is so drastically different that having anyone else maintain these services would require tons of training. Meanwhile Go is extremely practical and very easy to learn.
What.
(Honestly, whenever I have to go back to programming in a language without cheap threads I am often sad with the BS that comes out of my fingers. Single-threaded languages, even ones wrapped around an event loop with various hacks to try to obscure the single-threadedness, are so 20th century compared to the ones that were built for it from day one.)
I have high hopes for Rust, though. Even quite a few people at Google seem to have converted to the Rust camp, away from Go.
What exactly are you trying to do? Golang was designed from the start for high concurrency programs. Instead of threads, they use go routines.
OTP being missing matters less than you might initially think, too. I implement what bits of supervisor trees can be implemented here: https://github.com/thejerf/suture , and in general, with the way Go is structured, gen_servers and such just sort of melt away into "things you interact with over channels" without much fuss. (IMHO, OTP is generally a good thing, but the reification of gen_X so deeply into the language was an error. I actually prefer Go+Suture's way of bringing up a server; much simpler, virtually no loss of capability in practice. Again, the theoretical difference turns out to be larger than the practical difference.)
(And before someone angrily smashes the reply button, pleases meditate on the distinction between a "small difference" and "no difference", especially the subjective nature of such judgment calls. You can certainly quibble with the size I assign to the differences but please don't reply as if I claimed no difference, or as if I have not demonstrated awareness of the difference between a strictly-enforced no-sharing environment vs. unenforced no-sharing convention, and, likewise, let's not pretend "isolation by convention" is the same thing in practice as "traditional shared-memory threading". Memory sharing can bite you in Go, and while I've gotten pretty used to the necessary patterns to avoid that (spending years in Erlang first is really good training for that), I don't deny it is non-zero cognitive effort required.)
The reason people like Rust is it is different. It's what people wished C++ could have been so many years ago.
With that said though, each of the languages have its place and uses. Sure many things can be done with both of them, but some things only Rust can do/will be able to do(many unstable things still). Both languages will be successful imo.
I can see Go and Rust being taught as the primary languages in the academic world and in the enterprise world. If I were starting out in school, I'd probably pick Go and Javascript.
Elixir looks Ruby-ish, but that illusion breaks down very quickly since the underlying semantics are anything but. Not to mention Elixir doesn't shield you from having to be aware of the Erlang runtime, the VM and OTP.
tldr: functional languages were the future for Facebook's new spam fighting tool, they weren't for a startup owner who has previous professional Haskell experience. Consider for your next project and possibly live the future now.
For people reasons it is not (currently at least).
The second point trumps the first at this time. Unless I'm missing something the logic here is not as intractable as some seem to think.
Haskell is a very good flag for the kinds of people that make good programmers:
* It's hard to learn.
* Chances of getting a job are minimal, therefore people learn it mostly for their own self edification, and have the kind of grit that keeps them studying for a year or two with not external reward.
* Learning Haskell teaches you some fundamentals that aren't readily discoverable elsewhere.
No one is hiring Haskellers right now, so what you have is a pool of very able programmers, who would love to do Haskell (in fact many would love the chance to use Haskell so much that they'd take a pay cut to do so) and very few people offering them what they want.
If you're a start up, you want to hire a stellar team (possibly at a bit of a discount) and your domain is a good fit then you should seriously consider hiring some Haskellers and letting them write Haskell.
And fortunately, POSIX gives us those well-defined interfaces. POSIX process boundaries, pipes and Unix & TCP sockets are excellent interfaces to separate tools written in different languages. A well-written RESTful service listening on a Unix socket can work wonders.
If one's using POSIX, then one's team can work on each tool in the language which best suits it and in which the primary lead is most product. If someone moves on, then the rest of the team can support it because a) good programmers can pick up good languages quickly (I don't want to hire or work with mediocre programmers) and b) each service is small enough that anyone can understand what it does by looking at a small amount of code.
I mention this because there are ways to benefit from Haskell while still maintaining the sorts of "practical benefits" that are cited here.
"We present an Applicative abstraction that allows implicit concurrency to be extracted from computations written with a combination of Monad and Applicative."
The more your code is Applicative the more concurrency you can extract. It's a matter of good abstractions rather than the language. I'm sure Rust can handle Applicative and Monad just fine.
Were all my prejudices against the business practicality of functional languages wrong?
Nope.
"Biilmann no longer uses Haskell. It’s not entirely practical."
EDIT: ... and to say, if Facebook can't attract superstar Haskell programmers, then what chance any other startup?
Haskell at Facebook is still going strong with, I believe, two teams using it and actively recruiting. (I've been contacted by a recruiter myself, even.) And they've hired Simon Marlowe and Bryan O'Sullivan who are pretty much as superstar as they come. Recruiting woes are greatly exaggerated if not inverted for startups seeking a handful of engineers—Haskell actively attracts interesting candidates.
I've run Haskell services in production for more than 4 years and still operate 4 of them to this date. I also contributed the wai-eventsource module to the Yesod project and build a Haskell powered eventsource addon for Heroku.
It's not my impression that there are tons of other people in the bay area with as much experience in actually using Haskell for real world production stuff. Most of them are probably at Facebook now and the journalist behind the article did interview them...
That said, it's absolutely true that for Netlify I now use Go for the tasks I would have used Haskell for earlier.
Haskell is an awesome, mindblowing language, and when I started using it for production tasks it was by far the best tool for the job at the time. By now, however, Go is a far more pragmatic choice for most of the tasks I used Haskell for before.
Unless your whole stack is Haskell based, the context switching involved in going back and forth between more traditional languages and Haskell are really brutal. Apart from that, it's very easy to bring someone new onto a team and teach them enough Go to be productive in a day or two. You just can't do that with Haskell.
That said, it looks like a really, really good fit for what they're doing at Facebook with regards to spam filtering. I can totally see how you can make a safe DSL for rules that will be statically type checked and handle concurrency without any need for developers to think about it, and the Haskell runtime is incredible for these kind of things.
Its mathy syntax? Its unique concepts? The practical side (installing, configuring and libraries can still be troublesome)?