Skip to content

Instantly share code, notes, and snippets.

@theboreddev
Created November 21, 2021 07:06
Embed
What would you like to do?
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