The alt method allows us to recover from a nothing with a default Maybe, but sometimes our recovery efforts might need to enlist some logic to recover properly. In this lesson, we’ll see how we can use the coalesce method on the Maybe to recover from…
Once we’re using Maybes throughout our code, it stands to reason that at some point we’ll get a Maybe and want to continue applying transformations. We might get a Nothing and want to perform those same transformations on some default value. In this…
Functions are first class in JavaScript. This means we can treat a function like any other data. This also means we can end up with a function as the wrapped value in a Maybe. The Maybe type gives us the ability to apply that wrapped function to othe…
You probably have functions that aren’t equipped to accept a Maybe as an argument. And in most cases, altering functions to accept a specific container type isn’t desirable. You could use map, passing in your function, or you could “lift” your functi…
We can dot-chain our way to great success with an instance of Maybe, but there are probably cases where you need to apply the same series of transformations against different Maybes. In this lesson, we’ll look at some point-free versions of some comm…
Sometimes, we run into situations where we end up with a Maybe within the context of another Maybe. Nested structures like this can get really confusing to work with. In this lesson, we’ll look at an example of this and see how chaincan help us out b…
In this lesson, we’ll look at the propPath utility function. We’ll ask for a property multiple levels deep in an object and get back a Maybe. We’ll get a Just when the property exists at our path and a Nothing if any part of the path is undefined. co…
In this lesson, we’ll use a Maybe to safely operate on properties of an object that could be undefined. We’ll use our initial code as the basis for a prop utility function that can be reused with different objects and various property names. Instead…
In this lesson, we’ll create a safe function that gives us a flexible way to create Maybes based on a value and a predicate function that we supply. We’ll verify its behavior with values that satisfy the predicate, and values that do not. We can writ…
In this lesson, we’ll get started with the Maybe type. We’ll look at the underlying Just and Nothing types and create a simple utility function to create a Maybe from a value. Then we’ll see how we can apply functions to values and skip invocation fo…