1. 13
    Randomly Pull an Item from an Array with the State ADT
    4m 39s

Randomly Pull an Item from an Array with the State ADT

Share this video with your friends

Send Tweet

Functor composition is a powerful concept that arises when we have one Functor nested in another Functor. It becomes even more powerful when both of those are Chains, allowing us to apply each Functor’s special properties and effects for a given computation.

We witness this power first hand by combining our beloved State with a Pair type mixing the ability to randomly pick an index from an Array using State and use it to draw an element from the Array. We will build up to an easy to use interface that allows us to pull as many elements as we need, by chaining on single State transaction.