Skip to content

Instantly share code, notes, and snippets.

View ajaypro's full-sized avatar
:octocat:
open source = great knowledge + fast upgrade

AjayDeepak ajaypro

:octocat:
open source = great knowledge + fast upgrade
  • Plume - Smart Wifi Services
  • Amersterdam, Netherlands
View GitHub Profile
@ajaypro
ajaypro / RailwayOP-CompleteExample.kt
Created September 13, 2019 10:19 — forked from antonyharfield/RailwayOP-CompleteExample.kt
Railway Oriented Programming in Kotlin (as described here)
// Result is a superpowered enum that can be Success or Failure
// and the basis for a railway junction
sealed class Result<T>
data class Success<T>(val value: T): Result<T>()
data class Failure<T>(val errorMessage: String): Result<T>()
// Composition: apply a function f to Success results
infix fun <T,U> Result<T>.then(f: (T) -> Result<U>) =
when (this) {
is Success -> f(this.value)
@ajaypro
ajaypro / introrx.md
Created November 24, 2018 07:38 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing