Skip to content

Instantly share code, notes, and snippets.

@theboreddev
Created October 27, 2021 06:35
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 theboreddev/9482e8107985bdc454f7f95ff9b3b81f to your computer and use it in GitHub Desktop.
Save theboreddev/9482e8107985bdc454f7f95ff9b3b81f to your computer and use it in GitHub Desktop.
Using flatMap
fun generatePayrollFor(employeeName: String): Either<Problem, Payroll> {
return employeeService.findEmployeeByName(employeeName)
.flatMap { employee ->
buildPayrollForEmployee(employee)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment