I’d like to add one more point to think about: You probably don’t want to have any data types that are intended to end up on a ledger in such a library. If you change your library or have to recompile it with a different version of the SDK, you will end up with a different package ID and hence the types are considered different.
For daml-stdlib
, we jump through quite some hoops to get stable names for type like Either
. More precisely, we put each such type in its own package without anything else around it and never recompile it. (In fact, we never compile it at all but rather write the DAML-LF without having any DAML for it.)