Exploring-Fp-Ts

Handling Error Cases

Handling Error Cases

Note: This article is based on fp-ts version 1

For guides on how to use version 2 please refer to the fp-ts website

In any codebase there are several paths which can fail. Like I discovered with handling nullable values I want to flow through the code and deal with errors gracefully and in a logical manor. Too many times have I found I’ve written a tangle of if statements and try / catch blocks which make reading a logical set of instructions hard.

Working with Nullable Values

Working with Nullable Values

Note: This article is based on fp-ts version 1

For guides on how to use version 2 please refer to the fp-ts website

It’s such a pain dealing with values which could be null or undefined. I like to get rid of the potential for them as much as possible when designing interfaces but there is no escaping it sometimes. I hate it even more when you have a set of them, which you need to check before moving on.

Exploring fp-ts Series Intro

Exploring fp-ts Series Intro

We’re using a lot more functional programming styles and pattens in our codebase. Part of getting better at using these patterns is knowing the tools available. Most of our codebase is TypeScript so we have chosen the fantastic fp-ts library.

I’m still maturing my fp understanding as well as exploring how it all works with fp-ts so I’ll gradually build a series around our journey. I’ll start with three of the most common use-cases our team needs to get their head around: handling nullable values, errors and async functions. I will try and expand on this in time.