Skip to content

Instantly share code, notes, and snippets.

@jooohn
Created March 19, 2018 15:33
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 jooohn/b4b9d28085de960efd35c45ad6fe6547 to your computer and use it in GitHub Desktop.
Save jooohn/b4b9d28085de960efd35c45ad6fe6547 to your computer and use it in GitHub Desktop.
type ActionCont[T] = EitherT[Future, UseCaseResult, A]
final class FindWarriorImpl[Ctx <: IOContext](
ctx: Ctx,
repository: WarriorRepository[Future]
) extends FindWarrior {
def apply(id: WarriorId): ActionCont[Warrior] = EitherT {
repository.resolveBy(id) map {
case Some(w) => Right(w)
case None => Left(WarriorNotFound)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment