The Monad Challenges

PureScript Edition

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

MCPrelude documentation

This project is maintained by shaunplee and is a fork of the Monad Challenges 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 Array type. Import your Card data constructor from Set 3. Using do syntax, implement the following functions:

allPairs :: forall a b. Array a -> Array b -> Array (Tuple a b)
allCards :: Array Int -> Array String -> Array Card
allCombs3 :: forall a b c d. (a -> b -> c -> d) -> Array a -> Array b -> Array c -> Array d

Previous Page