Skip to content

Instantly share code, notes, and snippets.

@theboreddev
Created November 21, 2021 07:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save theboreddev/7fab0d460eb4478b9f0142d28b7f9cc1 to your computer and use it in GitHub Desktop.
Save theboreddev/7fab0d460eb4478b9f0142d28b7f9cc1 to your computer and use it in GitHub Desktop.
all together
fun generatePayrollFor(employeeName: String): Either<Problem, Payroll> {
return employeeService.findEmployeeByName(employeeName)
.flatMap { it?.let { buildPayrollForEmployee(it) } ?: UserDoesNotExistProblem(employeeName).left() }
.tapLeft {
logger.info("Could not fetch employee: ${it.message()}")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment