Challenge 1: Eliminate Exceptions Using the Either Monad
Test your knowledge by rewriting the given code without using any exceptions.
We'll cover the following...
We'll cover the following...
A code snippet is given below. It has an authenticateUser function that authenticates the provided username and password with the stored username and password. If authentication fails, the program throws an exception.
Problem statement
Eliminate the exception in the snippet above by rewriting the authenticateUser as a two-track Either monad-based function. You have to perform the following tasks to complete the challenge:
-
If the provided
usernameis not valid, then the string returned by the ...