The Alt provided by fp-ts

Before talking about the Alt provided by fp-ts, we need to understand two terms. Associativity and Distributivity.

By associativity, I mean the composition of functions in which the order of the above functions is not important for result. Example from arithmetic:

Distributivity can be understood as the consistency of two functions on one set of three arguments. Example:

Now let’s look at examples of these terms in Javascript.

Now let’s see what possibilities the Alt provided by fp-ts gives us using Array and Option as examples.

The Alt provided by fp-ts Array is essentially a list concatenation function. Let’s see an example:

The Alt provided by fp-ts Option is a function that takes the other option if the main one is none. Let’s see an example:

With this article, I want to start a series on fp-ts. If you have a desire to make out something specific provided by fp-ts, write in the comments.Thanks for reading!