How to create a custom variant codec in elm-serializer?

Looking for code by @miniBill I found this discussion from last September that basically discusses the same question. @miniBill created some interesting code in Ellie. I have take a good look at it. But by the looks of it, it would indeed be great if this becomes available in a library. See: https://discourse.elm-lang.org/t/extracting-type-metadata-from-elm-code/6251