https://kotlinlang.org logo
#arrow
Title
# arrow
h

herlevsen

02/06/2019, 3:30 PM
Maybe you are right, but that would become very messy if i were to have many of these “validation” functions, and i had to stuff them all in one file. To give you some context i am building an Api, and I am using a Sealed class to Model all the errors, that a specific part of the application can return as a response. So the checkUserIsOldEnough function should be able to return a subset of the errors from that common Error sealed class. I really like the idea of just returning a Sealed class from the checkuserIsOldEnough function, but I dont want to have to map the result from that sealed class to a result of the Error sealed class that the api returns. Does that make sense?