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
- Host: GitHub
- URL: https://github.com/harikrishnan83/railwayorientedprogramming
- Owner: harikrishnan83
- Created: 2020-02-25T14:04:18.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2025-04-22T05:23:55.000Z (about 1 year ago)
- Last Synced: 2025-04-28T15:07:44.145Z (about 1 year ago)
- Topics: arrow-kt, either-monad, kotlin, railway-oriented-programming
- Language: Kotlin
- Homepage:
- Size: 154 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Kotlin Railway Oriented Programming
[](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
[](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)