Now I’ve noticed some rather strange behaviour. There is a common file, src/main/daml/Daml/Finance/Types.daml that has some common type definitions. It sits outside of the Interface or Implementation directories. Yet it is pulled into the builds (I can see this with damlc inspect).
What happens if I have dependencies to these common types in both the interface and implementation package? Shouldn’t there be some sort of a package clash, because it’s being included in both of them now? Is there any way to prevent this kind of behaviour? For instance, could I use the build-options : -I directive instead of source : ? Is there any difference here?
• Couldn't match expected type ‘Implementation.Types.Foo’
with actual type ‘Interface.Types.Foo’
NB: ‘Interface.Types.Foo’
is defined in ‘Daml.Finance.Types’ in package ‘daml-finance-interface-1.0.0’
‘Implementation.Types.Foo’
is defined in ‘Daml.Finance.Types’ in package ‘daml-finance-implementation-1.0.0’
• In the expression: Interface.Types.Foo
In the expression: [Implementation.Types.Foo, Interface.Types.Foo]
In an equation for ‘foos’: foos = [Implementation.Types.Foo, Interface.Types.Foo]
So, my suggestion would be to split off the shared parts into a separate package that can be depended on by both interface and implementation packages. I think in that case these two wouldn’t need the .. parent directory in their configuration files, since they would just depend on the types package directly. The main drawback would be needing to build the dars sequentially, but that can be taken care of outside of damlc.