Generating ReasonML code from Kotlin data classes?

interop

#1

Are there existing tools that help produce ReasonML type-binding declarations from Kotlin data classes? This would help streamline some tedious, mechanical coding work involved with Kotlin/ReasonML interoperability.


#2

I don’t know of a ready-made Kotlin-data-class-to-ReasonML generator. A practical route is to emit an intermediate schema from Kotlin—via KSP, a compiler plugin, or Kotlin serialization descriptors—then generate ReasonML records and variants from that schema with a small script. This handles nullability, lists, enums, and nested classes more reliably than parsing Kotlin source text. If the types are only for JS interop, consider generating external declarations rather than full type bindings.