PureScript Edition
A set of challenges for jump starting your understanding of monads.
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
As we have done before, look at your allPairs
and allCards
functions and find the differences. Then implement a more general function that can be used to implement both allPairs
and allCards
. Call this new function allCombs
.
allCombs :: forall a b c. (a -> b -> c) -> Array a -> Array b -> Array c
Then go back and reimplement allPairs
and allCards
in terms of allCombs
. Verify that they do the same thing as the original functions.