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.
7.4
JEREMY: Katie, thank you for inviting me to Facebook to meet you and–
11.1
KATIE: You’re welcome.
12
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.
23.2
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.
31.6
JEREMY: Oh, right. Good.
32.5
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.
40.2
JEREMY: Oh, how sad.
41.2
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.
60.2
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?
72.9
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.
95.7
JEREMY: How do you spell Haxl? Sorry.
96.9
KATIE: It’s H-A-X-L.
98.1
JEREMY: OK. We’ll google it.
99.7
KATIE: Haxl.
100.2
JEREMY: Cool.
101
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.
114.6
JEREMY: And there are lots of people using Haskell at Facebook.
117.7
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.
129.2
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.
143.1
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.
162.8
JEREMY: A nice holiday. A nice functional holiday in Japan. Very good. OK.
167.3
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.
185.9
JEREMY: So kind of the battle is almost half won, you’re saying already.
189.9
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.
206.4
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.
219.3
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.
243.4
JEREMY: OK.
244.4
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–
263.2
JEREMY: But we’ll come to that next week.
265.1
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.
278.4
JEREMY: OK.
278.7
KATIE: And they’re useful. And that’s it. That’s really all there is to it.
281.7
JEREMY: I feel slightly reassured then. Thank you. OK.
284.3
KATIE: Glad I could be of service.
285.6
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.
297.9
KATIE: OK, sure. First, I should clarify when I say monads are superheroes, I’m not trying to add another analogy–
303.1
JEREMY: Oh, right.
303.9
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.
328.8
JEREMY: Yes.
329.1
KATIE: So you can say this.
329.7
JEREMY: Yes.
330.4
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.
341.6
JEREMY: OK. More next week.
343.4
KATIE: Yes, sure. I’m sure you’ll go into all the details.
345.8
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?
361.8
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.
397.4
Most importantly, though, I think it’s great to learn functional programming just to learn how to think in a different way about problems.
402.8
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?
414.9
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.
422.7
JEREMY: It’s quite loud.
424.4
KATIE: It is. Do you want me to demonstrate?
427.5
JEREMY: Well, why don’t we ship our interview, and you can whack the gong to tell everyone we’ve done it.
433.2
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