I am the maintainer of a package on hackage, lrucache. I recently received a feature request for adding instances for Binary
and NFData
. Both of those are useful things to have, and I have no issue with those instances, in principle.
However, both of them introduce new package dependencies, and I want to keep my package's dependency list as minimal as possible. Is there a sane way to handle this? There are probably well over twenty different packages that provide useful type classes the data structures in lrucache
could implement, and get some benefit from.
Obviously, adding all of them as dependencies is a non-starter. But what else can be done?
I can add flags to lrucache.cabal that will enable compiling various instances. That works, in terms of making the dependency list minimal, except when you want it. But it's horrible in the real world, because you can't specify build flags in build-depends sections. So you can depend on a package with a particular flag, but not specify that dependency. This quickly reduces to near-uselessness.
I can create a bunch of orphan instance packages. This has the advantage of allowing dependencies on those instances to be specified in a build-depends section. Its main disadvantage is adding a ton of extra packages to hackage, and needing to maintain them as separate packages.
What else can I do? What's the right thing to do?
./configure --enable-Z
. I like things simple -- having a package marked installed means it's installed, not "it's installed with options X and Y but not Z". Perhaps Hackage could organize orphan instances packages better, but I don't think they're illegitimate in concept. – gatoatigradonfdata
can have the instance in the main package -- its a dependency for plenty of core packages already.binary
used to be the only go-to serialization package, but there are a few competitors now. For that, a separate package could be okay, but if the serialization code is straightforward enough, you could just provide it in docs/a wiki page, and let users write their own instance or serialization code when necessary. – sclv