Data dependencies and operator fixity

Hi,

Assume that a package A imports a package B as a dependency. B defines a new operator, as well as its fixity.

Is it correct to assume that the fixity of the operator is ignored in A when B is imported as a data dependency?

Background :

the expression here fails to compile when daml-ctl is imported as a dependency, but works fine if it is a data-dependency.

daml-ctl defines

  • &&& as infixr 3
  • <<< as infixr 1

Thank you,
Matteo

Hi @Matteo_Limberto, thanks for bringing this up. Your assumption is correct, but shouldn’t be :slight_smile: What’s happening is that .dars (currently) do not preserve fixity information, so when the compiler sees the operators it just assumes they are infixl 9 by default.

I’ve opened [Data Dependencies should preserve fixity information · Issue #13763 · digital-asset/daml · GitHub] to track this. Please note that any fix to this will only work for newly produced .dar files, so if your program relies on the fixity of operators defined in a data-dependency, this data-dependency will need to be recompiled into a .dar that does have the fixity information.

2 Likes