3 ms·
Why not just use Jackson? Sure, it doesn't have a clever DSL. But then, that's a feature.
by EdwardDiego 5y ago
Why not just use Jackson? Sure, it doesn't have a clever DSL. But then, that's a feature.
- lmm 5y agoJackson has its own parallel "type registry" to make up for not being able to use something like Shapeless, because the problem still has to be solved. Getting a failure at compile time if there are any cases that wouldn't serialize properly is a huge advantage; a nontrivial proportion of production outages I've seen were Jackson.
- EdwardDiego 5y agoI'll be honest, I had a quick look at Shapeless, and couldn't see how you'd apply to ensuring an entity serialized correctly. But I'm keen to learn more :) I always prefer compile time to run time errors.
- lmm 5y agoWhat Shapeless gives you is the ability to treat value-like types - case classes and sealed traits - generically. And so you can do "walk the object graph" style stuff at compile time - particularly, typeclass derivation. https://circe.github.io/circe/codecs/auto-derivation.html https://circe.github.io/circe/codecs/auto-derivation.html is one popular library that does this - note that the `.asJson` will fail at compile time if you add a member to Greeting or Person whose type can't be serialized/deserialized (e.g. File or Lock or something) i.e. one that doesn't have an Encoder typeclass instance available.
- EdwardDiego 5y agoOkay, that's pretty cool. Cheers :)
- mohanmcgeek 5y agoThese decisions aren't made by me. can never convince the FP purists to let you use a non FP library.