An open API service indexing awesome lists of open source software.

https://github.com/harikrishnan83/railwayorientedprogramming

Kotlin Railway Oriented Programming
https://github.com/harikrishnan83/railwayorientedprogramming

arrow-kt either-monad kotlin railway-oriented-programming

Last synced: about 1 year ago
JSON representation

Kotlin Railway Oriented Programming

Awesome Lists containing this project

README

          

# Kotlin Railway Oriented Programming

[![CI](https://github.com/harikrishnan83/RailwayOrientedProgramming/actions/workflows/ci.yml/badge.svg)](https://github.com/harikrishnan83/RailwayOrientedProgramming/actions/workflows/ci.yml)

## Code related to below blogs

https://medium.com/@harikrishnan/railway-oriented-programming-dd74dbf0dfae

https://medium.com/@h/refactoring-if-else-either-and-flatmap-4f1ca9076664

## Conference Talk

Proposal - [The Functional Fix: Kotlin Error Handling Made Elegant](https://confengine.com/conferences/functional-conf-2025/proposal/21329/the-functional-fix-kotlin-error-handling-made-elegant)

Slides - https://speakerdeck.com/harikrishnan83/the-functional-fix-kotlin-error-handling-made-elegant

Video

[![The Functional Fix: Kotlin Error Handling Made Elegant](https://img.youtube.com/vi/byIcRxtk6gA/maxresdefault.jpg)](https://www.youtube.com/watch?v=byIcRxtk6gA)

## Initial code

We start with this procedural code that is mainly using if-else to handle errors.

[Step 0: Procedural Code](src/main/kotlin/com/ropsample/arrow)

## Refactoring steps

### Solving the problem with Kotlin

[Step 1: Method Extraction](src/main/kotlin/com/ropsample/methodExtraction)

[Step 2: Lining up the functions](src/main/kotlin/com/ropsample/liningupthefunctions)

[Step 3: Railway Oriented Programming](src/main/kotlin/com/ropsample/railwayorientedprogramming)

### Using Arrow

[Step 4: Using Either And FlatMap](src/main/kotlin/com/ropsample/arrow)

[Step 5: Extracting error handling](src/main/kotlin/com/ropsample/arrowandinfix)