MarioAriasC / funKTionale

Functional constructs for Kotlin
913 stars 71 forks source link

Functions like Try.flatMap or fold swallow RuntimeExceptions #39

Open nhaarman opened 6 years ago

nhaarman commented 6 years ago

Functions like Try<T>.flatMap and Try<T>.fold swallow RuntimeExceptions, making it harder to find bugs.

For example, I tried to use a TODO(), but my application did not terminate:

fun main(args: Array<String>) {
    val result = Success("Test").flatMap<Unit> { TODO() }
    println(result)
}

Instead, the console prints

Failure(kotlin.NotImplementedError: An operation is not implemented.)