Created
September 14, 2012 16:58
-
-
Save adinapoli/3723225 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
createUser :: Text -- ^ Username | |
-> ByteString -- ^ Password | |
-> Handler b (AuthManager b) (Either String AuthUser) | |
createUser "" _ = return $ Left "Username cannot be empty" | |
createUser unm pwd = withBackend (\r -> liftM (\x -> Right x) $ liftIO $ buildAuthUser r unm pwd) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It yields the correct type, but it's ugly.
a) How to beautify that liftM?
b) Is it convenient to create a type synonym like BackendStoreFailure or something like that opposed to String which doesn't characterize what's going on?