Monorepo: Cabal internal libraries vs multi-package Cabal

I agree with most of that blog post, but I feel like there’s one extra axis that could be covered.

As a library author I wish to have:

  • A clean interface that guarantees safety regardless of input quality. For the core library I prefer foo, for a cross-dependency with bar I call it foo-bar.

  • A dirty interface for datatype internals, basic helper functions and unsafe variants of functions that have undefined behaviors on certain inputs. This should be as well-documented as the clean interface and I’d call it foo-unsafe.

  • An internal interface that is used to construct the previous two interfaces and is as such a box of three hundred undocumented definitions of no interest to anyone but me. This would be foo-internal and I don’t want anyone but me to be able to import modules from this.

All three should have different PVP versions. Though I guess for the internal interface the PVP does not matter.

I assume this would be some variation of a multi-package setup, since modules would be shared between the interfaces.

1 Like