Edward Kmett - How I discovered Functional Programming

January 5, 2022
Edward Kmett spoke to us after presenting his keynote at Functional Conf 2019
Transcript

I'd been building little toy languages that all felt kind of like the bastard child of Perl and Python and C++ or something like that, because they were what I knew for, like, 15 years or something like that. Well, before I really discovered functional programming per se, when I was writing Perl, I understood you have maps.

You apply mapping, you map over a list, and you can apply some action for everything in there.

So there was some imperative, functional, mixed metaphor kind of code going on in what I was writing, but it wasn't really seeped into my bones.

And later on, I had written a JavaScript compiler in JavaScript that compiles JavaScript to JavaScript. It used a technique that comes out of the functional programming community called continuation passing style. So if you've run a web page and it's got a bunch of code on it, maybe sometimes you've sat there in the browser, has done this like, hey, this page is taking too long. Do you want to stop the code running?

You used to see this message a lot. You don't see it so much anymore.

And to avoid that, if you wanted to do a lot of work on the page, being able to take a snapshot of where you are in the middle of a long running computation and capture it and then set a little timer and then come back after the user interfaces had some time to do its thing lets you sidestep that kind of messaging. I was doing a bunch of stuff with that.

And then Google released this thing called the Google Web toolkit, which was the idea that you could compile Java to JavaScript. And so they got types and an IDE support, and they got all sorts of goodies that I wasn't getting out of this. The idealised form of what they built was better than the idealised form of the thing I was building. So I abandoned it and sold it to a company that was doing some debugging stuff.

But I really knew JavaScript very well at that point and they were trying to do a new JavaScript standard. And the only language I could think of that had all the features that were trying to put into this version of ACMA script.

This is before Harmony was Perl six, and I knew Perl really well. I ran a whole phone company on it for a long time. And so I said, okay, well, the working implementation of Perl Six is in this language Haskell whatever the heck that is. I'll just learn Haskell and write this JavaScript script implementation for this new language standard.

That was going to be a new thing and run it server side. So maybe somebody wants to run JavaScript on their server. This was before node by a considerable margin, and I would go from there.

And then I got involved in the Haskell community. I just sat in the Haskell IRC channel and asked some questions and there was a guy answering questions using math I didn't know to solve computer science problems I didn't know.

I just had a Masters in each of these things, and it almost infuriated me like I did that to put it to bed so I wouldn't be in this situation. I wanted to have the breadth. So, okay, that's a thing.

Now I can go put a suit on and make a bunch of money and go buy an island somewhere.

And all of a sudden, I got a good glimpse of how little I actually knew, and I just assumed that everyone in the Haskell community was like this guy - Cale Gibbard for the Haskellers in the audience - that knew all this math and all this category theory and all this computer sciencey stuff because he was sitting on an IRC channel fielding questions from like, five people at a time using math I didn't know to solve computer science problems I didn't know, and it was just mind boggling to me.

So I learned category theory, and I learned type theory by just like, throwing myself at every paper I could get my hands on for the next six months. And I didn't stop until I emerged a Haskeller, and it was really like the idea that I'd been building all these toy languages and Haskell had better versions of my ideas, which was not a thing I was expecting like to come in and have this thing that I've been chewing on, chewing on in the back of my brain for 15 years or something like that at that point and Haskell just have better solutions. So I had to decide, do I stick my head back in the sand and pretend I didn't see any of this stuff?

Or do I make their solutions my own? And it took me a good chunk of time. But I eventually made their solutions my own and tried to do everything I could to try and advance the role of Haskell in the world.

Don't miss out on Functional Conf 2022

REGISTER NOW

Leave a Reply

Your email address will not be published.

FOLLOW
US
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram