Last active
March 31, 2017 16:45
-
-
Save JorgeCastilloPrz/5d08d79ab1911d23106fc3258145cdc3 to your computer and use it in GitHub Desktop.
gist for article
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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