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<TryPartition<Pet>> = lines.map { it.map(::toPet).partitionTry() }
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.