kioba
02/10/2019, 12:42 PMmonad().binding { }
is deprecated but I could not figure out how should it be replaced. Trying to use Options and if one of the field is missing just return None.
example: override fun getUser(): Option<AccessToken> =
Option.monad().binding {
AccessToken(
refresh_token = storage.getString(refreshToken, null).toOption().bind(),
scope = storage.getString(scope, null).toOption().bind(),
token_type = storage.getString(tokenType, null).toOption().bind()
)
}.fix()
Should I just use .flatMap
? Is there a new way to do monad comprehension over Options?