Skip main navigation

New offer! Get 30% off your first 2 months of Unlimited Monthly. Start your subscription for just £35.99 £24.99. New subscribers only T&Cs apply

Find out more

Haskell at Facebook

Haskell is widely used in industrial software engineering. In this video, Jeremy Singer interviews Katie Ots from Facebook.
JEREMY: Katie, thank you for inviting me to Facebook to meet you and–
KATIE: You’re welcome.
JEREMY: –to see the sights of London. It’s great being here. I want you to tell me a little bit, please, about how you got into Haskell programming, where you found out about it, and why you like it so much.
KATIE: OK. So I learned about Haskell from a professor at my university. Like most universities, we have that one professor who’s really crazy about it.
JEREMY: Oh, right. Good.
KATIE: But unlike most people, I didn’t learn about it in official classes. The classes that included Haskell were unfortunately cut from the curriculum.
JEREMY: Oh, how sad.
KATIE: And this professor– very, very sad. This professor was so passionate, he offered to teach interested students in the library in his own time. So we had little secret sessions in the library to learn about functional programming and also logic programming. So he taught about a bit of Scheme, a bit of Prolog, and also some Haskell, and that’s how I was first exposed to it.
JEREMY: Wow, the secret functional society. That’s good, isn’t it? Haskell is used quite extensively at Facebook, isn’t it? Can you tell us a little bit about how you use Haskell in your day-to-day software development?
KATIE: Yes. I work on a system called Sigma, which is basically a rules engine for catching bad things on the site, things like spam, for example. And it’s a C++ Haskell hybrid, but it runs rules that are written in Haskell in EDSL, embedded domain-specific language, called Haxl, which is open source so people can check that out.
JEREMY: How do you spell Haxl? Sorry.
KATIE: It’s H-A-X-L.
JEREMY: OK. We’ll google it.
KATIE: Haxl.
KATIE: And this system runs more than a million queries a second to fight badness on the site. So Haskell is being used in the real world in production to help make Facebook a nicer place.
JEREMY: And there are lots of people using Haskell at Facebook.
KATIE: Yeah, not just me. We have dozens of people here who are writing these rules in Haskell and also people that are working on this project, of course, as well.
JEREMY: Can you tell us a little bit about the Commercial Users of Functional Programming Conference? You’re involved with that, I think, and that’s something that showcases functional programming in what you might call the real world, I suppose.
KATIE: Yes. And it’s been going for quite a number of years now, I think over a decade. So this is run as part of ICFP, the International Conference on Functional Programming, and I’ve been co-chairing it for this year and the previous year. And we’ve got some great talks coming up, so if anyone wants to head to Japan.
JEREMY: A nice holiday. A nice functional holiday in Japan. Very good. OK.
KATIE: But it’s at the stage now where it’s no longer a niche thing. I think when CUFP started it was people just finding camaraderie in other people having the frustrating experience of trying to get FP into their workplace and trying to make it work and convince their employers. I think we’re well past that now.
JEREMY: So kind of the battle is almost half won, you’re saying already.
KATIE: Well, certainly there are lots of big companies like Facebook that people can point to to say, well, why can’t we use it at my company? Facebook’s using it. And there are other big names. So a lot of that battle is won now. And the event has changed focus as a result of that.
JEREMY: On our course, Katie, we’re learning about monads. We’ve looked at Maybe and the IO monad so far. I’d like you to try and convince that monads aren’t scary.
KATIE: Oh, OK. So why do people even think monads are scary, right? Maybe, firstly, because that have an unfamiliar name– monad. People probably haven’t heard that word before, sure. And also because there’s this bit of a cottage industry of writing monad tutorials on the internet, and people think, oh, if it needs all these tutorials, it must be hard. Not true, not true at all. All monads are are basically a pattern. It’s the simplest way of explaining what it is.
KATIE: Monads are useful, because we believe in the DRY principle as good programmers– Don’t Repeat Yourself. And monads are simply a way of not repeating yourself. It happens to be that there are many quite disparate things actually, as disparate as Maybe and IO and Lists and a number of other things–
JEREMY: But we’ll come to that next week.
KATIE: –yes, yes– that fit a particular pattern. And that means that you can write code once for all the things that fit that pattern and not repeat yourself. And that’s basically it in a nutshell. And monad, of course, is only one of these abstractions that we have in Haskell. There are many others too.
KATIE: And they’re useful. And that’s it. That’s really all there is to it.
JEREMY: I feel slightly reassured then. Thank you. OK.
KATIE: Glad I could be of service.
JEREMY: We’re going to go into a lot more detail next week. But you’ve got a great video about monads as superheroes online. Can you ever give us a two-minute pitch of that, and we’ll post a YouTube link on our website below.
KATIE: OK, sure. First, I should clarify when I say monads are superheroes, I’m not trying to add another analogy–
JEREMY: Oh, right.
KATIE: –to all the analogies you already see out there about monads, because I believe it’s better to go from the concrete and see lots of examples and then build up your own intuition of what the abstraction means. So you’re not going to know what monads are just by hearing that they’re like superheroes. But in the talk, I basically just talk about what the key aspects of a monad are. So monads are basically– there’s a type class. I understand you’ve already taught that.
KATIE: So you can say this.
KATIE: A type class that has two– there’s another way to define it with three– but two or three key functions on it. And it needs to follow some laws, the way that you implement this. That’s really the crux of it.
JEREMY: OK. More next week.
KATIE: Yes, sure. I’m sure you’ll go into all the details.
JEREMY: We will, yes, excruciatingly. Thank you. Good. If someone on our course came along and said, right, will functional programming make me more employable? What would you say?
KATIE: This is a good question. I think that a lot of employers out there are starting to twig to the fact that people who are interested enough in programming to learn something that’s not the mainstream paradigm like functional programming tend to be good-quality programmers. So I think, in general, it serves you well to have those skills as part of your toolset. There aren’t as many purely functional programming jobs out there as there are other jobs, for sure, but they do exist. And it seems that their numbers are growing. So, yeah, I think it’s definitely a benefit to have those skills.
Most importantly, though, I think it’s great to learn functional programming just to learn how to think in a different way about problems.
JEREMY: Yeah. Good. We’ve been trying to emphasize that on our course. Thinking functionally is a good skill to have, even if you don’t use functional languages. Katie, tell us about the big gong that’s next to you. What’s this for?
KATIE: So this is a tradition here, that when you ship something, you get to come and hit the gong so the whole office can hear that something’s been shipped.
JEREMY: It’s quite loud.
KATIE: It is. Do you want me to demonstrate?
JEREMY: Well, why don’t we ship our interview, and you can whack the gong to tell everyone we’ve done it.
KATIE: All right. I don’t know how I’m going to explain this one, but sure.

Jeremy recently visited Facebook’s London office, where he met Katie Ots. She is a software engineer at Facebook, developing Haskell code for real-world applications.

Katie explained how and why Haskell is used at Facebook. She is also well-known for her talk on superhero monads. We will explore monads in more detail next week, but you might also want to check out her talk before then.

This article is from the free online

Functional Programming in Haskell: Supercharge Your Coding

Created by
FutureLearn - Learning For Life

Reach your personal and professional goals

Unlock access to hundreds of expert online courses and degrees from top universities and educators to gain accredited qualifications and professional CV-building certificates.

Join over 18 million learners to launch, switch or build upon your career, all at your own pace, across a wide range of topic areas.

Start Learning now