Last active
March 29, 2020 17:23
-
-
Save lforite/5b50fcbd04ec2293c4365cd09c479e17 to your computer and use it in GitHub Desktop.
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
| trait ServiceA { | |
| def createA(a: EntityA): Klesli[IO, CorrelationId, _] | |
| } | |
| trait ClientB { | |
| def getB(bId: EntityBID): Klesli[IO, CorrelationId, _] | |
| } | |
| case class ServiceA(clientB: ClientB) extends ServiceA { | |
| override def createA(a: EntityA): Klesli[IO, CorrelationId, _] = { | |
| for { | |
| entityB <- clientB.getB(a.idOfB) | |
| processed <- somePrivateBusinessLogic(entityB) | |
| cid <- Kleisli.ask() | |
| result <- someMoreBusinessLogic(processed) | |
| _ <- logger.info(s"Successfully processed entity ${a.id}") | |
| } yield result | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you wrote "Klesli" instead of "Kleisli"