Talks
Events

A Real World Example of Functional Programming with fp-ts

Frederick Fogerty at CityJS 2020

Have you thought about learning Functional Programming, but have been daunted by all the technical jargon? Luckily, in this talk I won’t be exploring any technical concepts, and instead will be walking through a real-world Javascript project and discussing how we can refactor it to a more functional style using a TS library, fp-ts. We will be using Functors, Monads, Applicative, and more, without having to know what they are or how they work!

At the end of the talk you should be confident to actually write functional code, and not just understand it, in your own projects.

About
imgix - Software Engineer working on OSS

Chapters / Excerpts
Start [00:00:00]

About Frederick [00:01:10]

What's in this talk [00:01:55]
I'm first going to briefly go over what FP and FPS it FETs are the kind of benefits and why you should use this functional programming paradigm that is so popular and getting popularity.

FP/FP-TS & Pro's / Con's [00:03:03]

The App [00:08:32]
We've briefly gone through what functional programming is and what if BTS is, and its pros and cons.

Validation [00:13:39]

Promise as a Framework [00:14:20]
You already know that familiar with promises and functional programming, because I believe with this mapping, then you can go and be more empowered

Task Either [00:17:43]
I've shown you a task either. And there's many other types which I'll get to at the end of the talk. But for now we're gonna use the task either.

Matching [00:19:43]
I thought about these behavior contracts. And that was for a reason we need to make sure that when we're writing functional code, that the functions will be cool and the framework we kind of pushed into always match. So how do you do that?

Consuming the function in the original API [00:21:00]
Now let's take a look at what it looks like to consume this function in the original API. And so we had this function and what I want to focus on at first is again, the function contracts.

Suggestions [00:24:06]
Refactoring [00:25:05] And I mentioned that one of the benefits was refactoring and I want to show how that looks like and how the toxicity helped us out.

Closing Thoughts [00:30:16]

Q&A [00:34:32]