Create linear data flow with container style types (Box)
We'll examine how to unnest function calls, capture assignment, and create a linear data flow with a type we call Box. This is our introduction to working with the various container-style types.
Refactor imperative code to a single composed expression using Box
We refactor 3 functions, taking line by line imperative code to a single composed expression using Box container type.
Enforce a null check with composable code branching using Either
We define the Either type and see how it works. Then try it out to enforce a null check and branch our code.
Use chain for composable error handling with nested Eithers
We refactor a function that uses try/catch to a single composed expression using Either. We then introduce the chain function to deal with nested Eithers resulting from two try/catch calls.
A collection of Either examples compared to imperative code
A tour of simple functions rewritten as composed expressions using Either set to 8 byte music and colorful flying blocks
Create types with Semigroups
An introduction to concatting items via the formal Semi-group interface. Semi-groups are simply a type with a concat method that are associative. We define three semigroup instances and see them in action.
A few examples of Semigroup definitions
Ensure failsafe combination using monoids
In this video we define monoids and promote our semigroups
A curated collection of Monoids and their uses
A gallery of monoid definitions and some use cases
Unbox types with foldMap
We get a clearer definition of what it means to fold a type, then we look at the foldMap function
Delay Evaluation with LazyBox
We rewrite the Box example using lazy evaulation
Capture Side Effects in a Task
We examine the data structure Task, see some constructors, familiar methods, and finally how it captures side effects through laziness.
Use Task for Asynchronous Actions
We refactor a standard node callback style workflow into a composed task-based workflow.
You've been using Functors
We learn the formal definition of a functor and look at the laws they obey.
Lift into a Pointed Functor with of
We examine the of function we've seen on a few types and discover it's the Pointed interface.
You've been using Monads
We discover, we've been using monads! We look a little further into the chain method and see laws that ensure the monadic structure works correctly.
Build curried functions
We see what it means to curry a function, then walk through several examples of curried functions and their use cases.
Applicative Functors for multiple arguments
Working our way backwards from solution to problem, we define an applicative functor, then use it to apply a function of multiple arguments.
Apply multiple functors as arguments to a function (Applicatives)
We find a couple of DOM nodes that may or may not exist and run a calculation on the page height using applicatives.
List comprehensions with Applicative Functors
We annihilate the need for the ol' nested for loop using Applicatives.
Write applicatives for concurrent actions
We start with two sequential finds using monads, then rewrite our code to achieve two concurrent finds.
Leapfrogging types with Traversable
We use the traversable instance on List to reimplement Promise.all() type functionality.
Maintaining structure whilst asyncing
We take our Promise.all() analogy further by using traversable on a Map(). Then we use two traversals in the same workflow.
Principled type conversions with Natural Transformations
We learn what a natural transformation is and see the laws it must obey. We will see how a natural transformation must uphold the law of nt(x).map(f) == nt(x.map(f)).
Apply Natural Transformations in everyday work
We see three varied examples of where natural transformations come in handy.
Isomorphisms and round trip data transformations
We formally define isomorphisms, make a few, then use them to accomplish normal programming tasks
Build a data flow for a real world app
We form a plan to find the common ground between two artists from the spotify api. Then we sketch out a data flow to ensure we have what we need, when we need it.
Retrieve and use data from an api with pure functional constructs
We flesh out the Spotify api with pure functional constructs to retrieve two sets of related artists.
Find the intersection of sets with Semigroups
We use semigroups to find the intersection of sets, then expand that to work on as many artists as we'd like. Finally, we use foldable to show a pair of intersection and sum to shed more light on the final result set.