Skip to content

Instantly share code, notes, and snippets.

@JorgeCastilloPrz
Last active July 31, 2018 11:32
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 JorgeCastilloPrz/c5ca918c765f9176a68caa8471ebdd71 to your computer and use it in GitHub Desktop.
Save JorgeCastilloPrz/c5ca918c765f9176a68caa8471ebdd71 to your computer and use it in GitHub Desktop.
allTasksByUserAsync.kt
override fun allTasksByUser(user: User): Kind<F, List<Task>> =
async { callback: (Either<Throwable, List<Task>>) -> Unit ->
Option.fromNullable(internetStorage[user]).fold(
{ callback(UserNotInRemoteStorage(user).left()) },
{ callback(it.right()) }
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment