The Monad Challenges

A set of challenges for jump starting your understanding of monads.

Outline

Set 1: Random Numbers

Set 2: Failing Computations

Set 3: Combinations

Set 4: Common Abstraction

Set 5: Do Notation

This project is maintained by mightybyte

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Do Notation – Set 3

Again, create a Monad instance for your [] type. Import your Card data constructor from Set 3. Using do syntax, implement the following functions:

allPairs :: [a] -> [b] -> [(a,b)]
allCards :: [Int] -> [String] -> [Card]
allCombs3 :: (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d]

Previous Page