Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save JorgeCastilloPrz/e295c38e5d20e5ad5b114732d73cfa5a to your computer and use it in GitHub Desktop.
Save JorgeCastilloPrz/e295c38e5d20e5ad5b114732d73cfa5a to your computer and use it in GitHub Desktop.
PolymorphicFunctionallTasksByUser.kt
fun allTasksByUser(user: User): Kind<F, List<Task>> =
localDS.allTasksByUser(user).handleErrorWith {
when (it) {
is UserNotInLocalStorage -> remoteDS.allTasksByUser(user)
else -> raiseError(UnknownError(it))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment