iex
05/16/2019, 6:47 PMout E
is where I started. See first snippetiex
05/16/2019, 6:48 PMiex
05/16/2019, 6:49 PME
as generic parameter to the function?iex
05/16/2019, 6:50 PME
from the instancestreetsofboston
05/16/2019, 6:51 PMstreetsofboston
05/16/2019, 6:52 PMfun testing() {
val x = Result.Ok(5)
val y = x.map { it * 2 }
val z: Result<Int,String> = Result.Err("Error")
val y2 = z.map { it + 4 }
val y3 = z.mapError { it.length }
val q: Result<String, Throwable> = x.flatMap { Result.Ok("$it") }
}
streetsofboston
05/16/2019, 6:54 PMiex
05/16/2019, 6:55 PMjoelpedraza
05/16/2019, 6:55 PMjoelpedraza
05/16/2019, 6:56 PMjoelpedraza
05/16/2019, 6:56 PMiex
05/16/2019, 6:56 PMjoelpedraza
05/16/2019, 7:00 PMiex
05/16/2019, 7:05 PMjoelpedraza
05/16/2019, 7:06 PMinline
allthethings