Skip to content
CCPEDIAby Unity Nodes
Discussions/App Development/Protected `export`sForum ↗

Protected `export`s

App Development2 posts349 views3 likesLast activity Jun 2021
LU
LucianoOP
Jun 2021

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.

CO
cocreature
Jun 2021

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.

← Back to Discussions