Last active
October 26, 2018 13:08
-
-
Save LucianU/eb8ddbb1c0581c00f2356176d8035511 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
userLogin :: EitherIO LoginError Text | |
userLogin = do | |
token <- getToken | |
userpw <- maybe (liftEither (Left NoSuchUser)) | |
return (Map.lookup token users) | |
password <- liftIO ( | |
T.putStrLn "Enter your password:" >> | |
T.getLine | |
) | |
if userpw == password then | |
return token | |
else | |
liftEither (Left WrongPassword) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment