Challenge 2: Error Messages Using Maybe Monad
Test your knowledge by writing code to convey error messages as an array using the Maybe monad.
Problem statement
In the previous lesson, we eliminated exceptions by rewriting the authenticateUser
function as a two-track Either monad-based function.
This time, you have to rewrite the function featured there to utilize Maybe monad case analysis.
Requirements
By maintaining all the requirements stated in the previous challenge, you have to perform the following additional requirement in order to complete the challenge:
- Convey each error message as an array with the
error
key by using the Maybe monad.
To reiterate, the requirements were:
-
If the provided
username
...