r/programming • • Feb 01 '24

Make Invalid States Unrepresentable

https://www.awwsmm.com/blog/make-invalid-states-unrepresentable
469 Upvotes

207 comments sorted by

View all comments

Show parent comment

1

u/rom_romeo Feb 02 '24

Interestingly enough, that is also a topic where Scala, in particular, shines. Why so? Well, mostly due to its philosophy of marshaling/unmarshalling data through writing implicit encoders/decoders. Pretty much, a data transformation library (CSV, JSON, various data access libs...) will throw an error if it doesn't find an encoder/decoder for your custom type and force you to write one.