Spotlight: Rebecca Skinner (Author) Interview and AMA!

This is a tough situation that I think a lot of FP enthusiasts find themselves in. We are definitely seeing a rising tide of FP in software these days, but there’s still a long way to go.

I’d consider myself a polyglot developer. I love Haskell, but I’ve spent a lot of my career working in all sorts of other languages. I’ve learned a few hard lessons about introducing people to FP, and in particular Haskell, in the workplace.

Perhaps the most important piece of advice I can give is that, in my experience, writing functional with the hope that people will see how elegant it is almost never works. More often than not, people will become resentful and start to more actively reject FP on principle. I’ve definitely seen situations where someone who has been using Haskell for a while brings an idea over to another language, and it caused a rift on the team. In fact, my experience is that people are more likely to reject FP style code from someone they know is an FP enthusiast than they are to reject the same code from someone they don’t think of as a functional programmer. It’s a silly bias, and it won’t be that way everywhere, but I think it’s common enough that you have to address the possibility head on.

The second best piece of advice I can give is, under no circumstances, should you just write some code in Haskell and hope for the best. It’s a great way to have exactly one project in Haskell and to never be allowed to explore other languages in the workplace again. I think it’s a bad knee-jerk reaction teams have, but it’s the common reaction.

Here’s what works best in my own experience: Start by meeting the team where they are, and walk them through the motivation behind the ideas that you want to implement. Don’t present a solution- instead, introduce a series of problems. If you can get a PR in, and add incremental PRs to refactor something into a more functional style, with a clear explanation of what each change brings, and get some reviewers to buy in, that’s a good approach. If you have design or architecture meetings with your team, that’s another approach. Don’t say “let’s do FP”- just present a specific real problem in your code and then introduce a very practical fix that happens to borrow from a functional style. Once you’ve done that a few times, and helped people understand the problems you want to solve, and see the patterns for solutions, then you can talk about ways to abstract the ideas into something that borrows ideas from an FP language. Eventually, you might want to say “hey, we’re doing some stuff that is kind of FP style, maybe we should prototype this new feature in Haskell. If we do that, we’ll want to rewrite it in our main language when it goes to production, but it could be instructive.” and then offer to pair with people, write lots of documentation, or whatever else your team likes to do to share information. Maybe even have a reading group (this was another scenario I had in mind for Effective Haskell, and it’s why I spend so much time in the book trying to walk through the motivation behind particular features).

It’s a lot of work, and a lot of it requires paying attention to people’s feelings and the politics of the team as much as the technical motivations, but it can be done. I’ve never turned a team into an entirely Haskell team, but I have had broad team buy in on using Haskell for parts of a system, and had people who didn’t previously have much interest in FP become competent Haskellers able to contribute to that codebase. Not every team will be open to the idea, but a lot will when it’s approach the right way.

5 Likes

Hello everyone!

I’m your friendly Devtalk bot :nerd_face:

Thank you to all of you who participated in our Spotlight AMA!

This is now closed and all of those who commented above have been entered into the draw - meaning we’re now ready to pick a winner!

The process will be initiated when somebody clicks the special link below:

:arrow_right: :arrow_right: :arrow_right: Devtalk - Dev forum at Devtalk - the forum for developers! :arrow_left: :arrow_left: :arrow_left:

Don’t be shy, we need one of you to help make the magic happen! :sparkles:

1 Like

Thank you for initiating the draw process…

Entering the following members into the draw…

:arrow_down: :arrow_down: :arrow_down: :arrow_down: :arrow_down: :arrow_down: :arrow_down: :arrow_down:

2 Likes

And the winner is…

Drum roll…

2 Likes

Congratulations @lockejan you are the chosen one!! We’ll be in touch about your prize via PM soon :smiley:

Thank you everyone who entered, and of course @RebeccaSkinner for taking part in our Spotlight - thank you! :blue_heart:

2 Likes

Amazing. Looking forward to diving into it. :slight_smile:

2 Likes

Congratulations @lockejan ! I’ll be PMing you in a moment about your prize. :slight_smile:

2 Likes

Hi Rebecca,

Would you mind sharing your thoughts on Haskell in relation machine learning and AI. I have read some people saying that it won’t cut it because of so few libraries etc and haskell is way to hard to debug, but then I have also seen some saying that it has some awesome qualities that will make it more popular in ML in the future. IIRC (paraphrase) one guy wrote that because of some intrinsic qualities of haskell either ML will go more towards haskell or other languages will steal these haskell features.

Do you have an opinion on this?

3 Likes

That’s a great question, and the answer is pretty nuanced I think.

At a high level, I’d say that today Haskell is probably more widely used for data engineering than for implementing models, Haskell’s data modeling capabilities and strong support for streaming data make it a great fit for a lot of data engineering work, and if I were trying to look for the best way to introduce Haskell to an ML team, I’d probably start there.

When it comes to implementing models, I think the choice is a bit more nuanced. There’s a lot Haskell brings to the table. Being able to model your data accurately and working with the type system to help you write correct code is a great benefit to building models since it makes it much easier to reason about how your models are being built. Even more importantly, being a pure functional language Haskell can give you some really amazing guarantees when you want to be able to understand and describe your system. Being able to understand how your models produce a decision, and being able to reproduce those results or test new models against historic data are huge problems that come up in any sort of data team, and Haskell allows us to model these constraints and guarantee we’re clearly capturing our inputs and outputs.

There are some challenges that come with using Haskell for writing models too. Library support is a consideration, but I often remind people to not worry about all of the libraries you don’t have, and just look to see if there are the specific libraries you need. If you’re comparing Haskell to something built largely by gluing together pieces of SciKit or Pandas or something then the library support will probably be a bit disappointing, but if you’re implementing most of your model yourself then Haskell’s going to compare a lot more favorably. Another challenge I see people talk about when using Haskell to build models is the fact that it’s often not as ergonomic to work with Haskell early in the process of developing a model. Optics give us the tools we need to arbitrarily traverse deeply nested data structures in an ad-hoc way, and more advanced type system features like GADTs can help us write code that we might use dataframes for in python, but getting to the point where you can use those things comfortably can involve a bit of an upfront investment, and it’s sometimes hard to convince people who are comfortable with Python that it’s going to be worth it.

On the whole, I think Haskell can be a great choice, but it’s also a particularly hard sell to data scientists in my experience. I’d certainly encourage you to consider trying Haskell for your own problems, and certainly look at it for data engineering problems, but for building models it’s probably best to work with your team and help them get comfortable with Haskell before you start trying to build significant work with it.

6 Likes

Thanks for the detailed answer! Personally I am almost half way through the book now. This gave me some ideas to think about.

3 Likes