Skip to content

Instantly share code, notes, and snippets.

@Drjacky
Created November 7, 2018 16:23
Show Gist options
  • Save Drjacky/ae2a0e6d1cabbb1f8b108101ca7da123 to your computer and use it in GitHub Desktop.
Save Drjacky/ae2a0e6d1cabbb1f8b108101ca7da123 to your computer and use it in GitHub Desktop.
Wrapping and Composing data
protected fun <D> wrapResult(): SingleTransformer<D, ResultState<D>> = SingleTransformer {
it.map { d -> ResultState.Success(d) as ResultState<D> }
.onErrorReturn { e -> ResultState.Error(e, null) }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment