Where to put encoders, decoders and generators?

For context, option 2 is how I currently have things set up in opensolid/geometry, and I think those encoders/decoders are likely to be used together. But as part of my current transition of opensolid/geometry to ianmackenzie/elm-geometry, I wondered if that was actually the best approach or if another way would be better.

True, but that doesn’t actually mean the encoders have to be in the same module as the type (unless encoding relies on private implementation details). In general it should be possible to implement encoders in a separate module in the same package, or even in a separate package that depends on the package defining the type.

2 Likes