arrow-exact
arrow-exact copied to clipboard
KotlinX.Serialization interop
KotlinX.Serialization has a great serialization story with regular Kotlin:
@Serializable
class Foo(
val username: String,
) {
init {
ensure(' ' !in username) { "The username cannot contain whitespace" }
}
}
If we follow the same approach of "just annotate it with @Serializable
", with our current design, it will be possible to deserialize values that are not valid.
I don't really see a good way to do this at the moment, I'm interested if you have any ideas.