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.

Random Character Generation

Now use the rand function to make your own function for generating random letters of the alphabet. It should only generate lower case letters a-z.

We supply a function in MCPrelude called toLetter. Use the toLetter function to write this random letter function:

randLetter :: Seed -> Tuple Seed Char

Now use this function to write another function randString3 that generates a random string of three letters using an initial seed of 1.

randString3 :: String

When you use this site to calculate the SHA-256 hash of the output of randString3, you get 6b70649415be2833ee195809e02c7911a9be16b68fa07d10b4a644efa177798a.

Previous Page - Next Page