Skip to content

Instantly share code, notes, and snippets.

Juan Ignacio Vimberg jivimberg

Block or report user

Report or block jivimberg

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
dam5s / Result.kt
Last active Nov 6, 2019
Railway oriented programming in Kotlin
View Result.kt
sealed class Result<A, B> {
abstract fun <C> map(mapping: (A) -> C): Result<C, B>
abstract fun <C> flatMap(mapping: (A) -> Result<C, B>): Result<C, B>
abstract fun <C> mapFailure(mapping: (B) -> C): Result<A, C>
abstract fun <C> flatMapFailure(mapping: (B) -> Result<A, C>): Result<A, C>
abstract fun orElse(other: A): A
abstract fun orElse(function: (B) -> A): A
data class Success<A, B>(val value: A) : Result<A, B>() {
cretz /
Last active Nov 12, 2019
Kotlin Annoyances

Kotlin Annoyances

These are things that I found annoying writing a complex library in Kotlin. While I am also a Scala developer, these should not necessarily be juxtaposed w/ Scala (even if I reference Scala) as some of my annoyances are with features that Scala doesn't even have. This is also not trying to be opinionated on whether Kotlin is good/bad (for the record, I think it's good). I have numbered them for easy reference. I can give examples for anything I am talking about below upon request. I'm sure there are good reasons for all of them.

  1. Arrays in data classes break equals/hashCode and ask you to overload it. If you are going to need to overload it and arrays have no overridability, why not make the least-often use case (the identity-comparison equals) the exception?
matklad / takeWhileInclusive.kt
Created Dec 24, 2016
An "inclusive" version of Kotlin's takeWhile
View takeWhileInclusive.kt
fun <T> Sequence<T>.takeWhileInclusive(pred: (T) -> Boolean): Sequence<T> {
var shouldContinue = true
return takeWhile {
val result = shouldContinue
shouldContinue = pred(it)
gabrielemariotti /
Last active Nov 3, 2019
How to manage the support libraries in a multi-module projects. Thanks to Fernando Cejas (

Centralize the support libraries dependencies in gradle

Working with multi-modules project, it is very useful to centralize the dependencies, especially the support libraries.

A very good way is to separate gradle build files, defining something like:

staltz /
Last active Nov 15, 2019
The introduction to Reactive Programming you've been missing
You can’t perform that action at this time.