Custom bounded types

-- | HIDE only hides it from the documentation, it has no semantic effect.

daml-stdlib doesn’t solve this problem. If you have a RelTime field on a template you can send whatever you want over the ledger API and no validation will take place. That’s what the thread I linked above discusses Should runtime/API respect namespace scopes?.

We do try to make it hard to accidentally construct it manually so directly in Daml you’ll have a hard time (I expect you can bypass the checks if you try hard enough but it’s not trivial):

  1. The actual type definition is in DA.Time.Types, DA.Time only reexports the type but not the constructor.
  2. The compiler has a hardcoded list of internal modules that you cannot import without getting an error.
  3. DA.Time.Types has special treatment in data-dependencies which means you also cannot directly bypass it that way.