Skip to content

Instantly share code, notes, and snippets.

@JorgeCastilloPrz
Last active March 31, 2017 16:45
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/5d08d79ab1911d23106fc3258145cdc3 to your computer and use it in GitHub Desktop.
Save JorgeCastilloPrz/5d08d79ab1911d23106fc3258145cdc3 to your computer and use it in GitHub Desktop.
gist for article
fun getSuperHeroes(): Reader<GetHeroesContext, Unit> =
Reader.ask<GetHeroesContext>().flatMap {
ctx -> ctx.getSuperHeroesInteractor.getSuperHeroes().map {
if (it.isEmpty()) ctx.view.showHeroesNotFoundError()
else ctx.view.drawHeroes(it.map { SuperHeroViewModel(it.name) })
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment