Skip to content

Instantly share code, notes, and snippets.

@LucianU
Last active October 26, 2018 13:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LucianU/eb8ddbb1c0581c00f2356176d8035511 to your computer and use it in GitHub Desktop.
Save LucianU/eb8ddbb1c0581c00f2356176d8035511 to your computer and use it in GitHub Desktop.
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