mirror of
https://github.com/digital-asset/daml.git
synced 2024-09-20 09:17:43 +03:00
Update docs for type synonyms generated by generic template instances (#3071)
This commit is contained in:
parent
125317cff0
commit
4623467c40
@ -276,10 +276,12 @@ In the context of the templates ``Iou`` and ``Proposal`` above, the generic temp
|
||||
:start-after: -- start code snippet: generic template instantiation
|
||||
:end-before: -- end code snippet: generic template instantiation
|
||||
|
||||
which does not produce a DAML data definition but only the DAML-LF record declaration:
|
||||
does not produce a DAML data definition but only the DAML-LF record declaration:
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
record IouProposal ↦ { proposal: Iou; proposers: List Party; receivers: List Party }
|
||||
|
||||
Note that ``IouProposal`` is a copy of ``Proposal`` with the type variable ``a`` replaced by ``Iou`` on the right hand side.
|
||||
|
||||
In DAML, ``IouProposal`` can also be used as a type synonym for ``Proposal Iou``.
|
||||
|
@ -48,7 +48,7 @@ We would like to model an issuing party (e.g. a bank) proposing a coin contract
|
||||
:start-after: -- start instance
|
||||
:end-before: -- end instance
|
||||
|
||||
Note that we must choose a name, here ``CoinProposal``, for creating contracts of this template in some client languages (for example when using the Java ledger bindings).
|
||||
Note that we must choose a name, here ``CoinProposal``, for the template instance. It serves two purposes. First, it provides a type synonym for the underlying type, here ``Proposal Coin``. Second, it must be used to create contracts of this template in some client languages (for example when using the Java ledger bindings).
|
||||
|
||||
With a template instance in place, we can create and exercise choices on contracts of this type.
|
||||
|
||||
|
@ -33,7 +33,4 @@ HEAD — ongoing
|
||||
- [Security] Document how to verify the signature on release tarballs.
|
||||
+ [DAML Ledger Integration Kit] The TTL for commands is now read from the configuration service.
|
||||
+ [DAML Ledger Integration Kit] The contract key tests now live under a single test suite and are multi-node aware.
|
||||
- [DAML Compiler] **BREAKING CHANGE** Desugar template instances to ``type`` synonyms instead of ``newtype``s.
|
||||
This type definition is easier to use in the surface DAML and consistent with the types translated to DAML LF.
|
||||
The only change to user DAML is that uses of the ``TI`` ``newtype`` generated from
|
||||
``template instance TI = T A1 .. AN`` should be simplified to use the type synonym ``type TI = T A1 .. AN``.
|
||||
- [DAML Compiler] Generic template instantiations like ``template instance IouProposal = Proposal Iou`` now generate a type synonym ``type IouProposal = Proposal Iou`` that can be used in DAML. Before, they generated a ``newtype``, which cannot be used anymore.
|
||||
|
Loading…
Reference in New Issue
Block a user