Backpack promises to let us solve the string problem by parametrizing packages over signatures. The idea is that this will allow us to change the ecosystem in a backwards compatible way: we can simply deprecate particular instantiations without changes rippling down the dependency graph.
What I am struggling to see is how I can use Backpack in a backwards compatible way. AFAICT, a backpacked project has to use Cabal 2.0 (previous versions of Cabal won't support all the new fields in .cabal
files). That would mean that I can only use backpack in projects that support GHC 8.2+.
Is there any hack around this? I'm looking for a way to use backpack such that:
- users on GHC 8.2+ can take advantage of a fully backpacked package
- users on older versions can still compile and use the project (but are stuck with some default instantiation of the signatures)
if impl(ghc >= 8.2) { signatures: foo }
will work work on v2.0 and on older versions (at least on 1.24; I don't know if this produced an error on some other version). As far as actual Haskell source files, I think at some point you'd still need to resort to CPP - but without specific examples (and I understand that these may be hard to come by given that the exploration of this feature has just begun) it's hard to say. – Pavo