Skip to content

Instantly share code, notes, and snippets.

@longliveenduro
Created September 27, 2013 15:20
Show Gist options
  • Select an option

  • Save longliveenduro/6730290 to your computer and use it in GitHub Desktop.

Select an option

Save longliveenduro/6730290 to your computer and use it in GitHub Desktop.
case object ArticleNotFound
trait ArticleService {
def getArticleDetails(articleId: Long): Future[\/[ArticleNotFound.type, ArticleDetails]]
def getArticleIdByUniqueName(articleName: String): Future[\/[ArticleNotFound.type, Long]]
}
def getArticleDetails(articleName: String): Future[\/[ArticleNotFound.type, ArticleDetails]] = {
for {
articleId <- articleService.getArticleIdByUniqueName(articleName)
article <- articleService.getArticleDetails(articleId)
} yield article
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment