Protected `export`s

Is there a way in Daml/Haskell to export functions like java’s protected? i.e. so they are only visible to a certain module(s)?

The reason I ask this is that I like to keep my test scripts in a separate file, but I often don’t want to export things like ‘helper’ functions which are internal to the module.

I suppose I could move the ‘helper’ functions into a separate module to segregate the ‘public’ and ‘private’ API, but that still doesn’t hide the private functions.

1 Like

Hi @Luciano,

In Daml the granularity of visibility for top-level definitions is limited to “visible only in this module” or “visible to all modules” (and a reminder that the former does not apply to Daml-LF and therefore the ledger API and data-dependencies, see Should runtime/API respect namespace scopes?). This is controlled via the export list at the top of a module. You cannot export something that is only visible to some modules.

2 Likes