Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
fun main() {
val lines = Try {
File("./my-pets.csv").readLines().map { it.split(',') }
}
val pets : Try<ResultSet<Pet>> = lines.map {
it.map(::toPet).asResultSet().map { pet -> pet.copy(name = pet.name.toUpperCase()) }
}
when (pets) {
is Success -> println(pets.value)
is Failure -> println(pets.error)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.