mirror of
https://github.com/digital-asset/daml.git
synced 2024-09-20 09:17:43 +03:00
Template instance type synonym polish (#3054)
* Release note * Desugaring is hard to type * Upgrade hlint version to new ghc lib * Use template instance type synonym in some tests * Rm space
This commit is contained in:
parent
13e6f581e3
commit
32e3099ddf
@ -572,7 +572,7 @@ hazel_repositories(
|
||||
# Read [Working on ghc-lib] for ghc-lib update instructions at
|
||||
# https://github.com/digital-asset/daml/blob/master/ghc-lib/working-on-ghc-lib.md.
|
||||
hazel_ghclibs(GHC_LIB_VERSION, "02c71094a0bb06d6f6c4bbd444f9a26804c8eca423cc77fd3824ccd498ddaefe", "4aa88ed404dcf8a67f712ad37d8ad9f4ed51fe6180c15978a97034acf7dee834") +
|
||||
hazel_github_external("digital-asset", "hlint", "f407a620cf38821320fb000e6ccd52f6bb081fc6", "5b5429a332910ebec481fe0f99ffce3159b10aef9188ba661512f8267fcde9a8") +
|
||||
hazel_github_external("digital-asset", "hlint", "193b3eb89d186ae901ff6d95a70653258ed5eed9", "4f99badd7058b10f89207622bc719bd22b65ad401bf21cf8b33a7d79bbc000f6") +
|
||||
hazel_github_external("awakesecurity", "proto3-wire", "4f355bbac895d577d8a28f567ab4380f042ccc24", "031e05d523a887fbc546096618bc11dceabae224462a6cdd6aab11c1658e17a3") +
|
||||
hazel_github_external(
|
||||
"awakesecurity",
|
||||
|
@ -496,7 +496,7 @@ convertTypeDef env (ATyCon t)
|
||||
, getOccFS t `elementOfUniqSet` internalTypes
|
||||
= pure []
|
||||
convertTypeDef env (ATyCon t)
|
||||
-- NOTE(MH): We detect type synonyms produced by the desugring
|
||||
-- NOTE(MH): We detect type synonyms produced by the desugaring
|
||||
-- of `template instance` declarations and inline the record definition
|
||||
-- of the generic template.
|
||||
| Just ([], TypeCon tpl args) <- synTyConDefn_maybe t
|
||||
|
@ -40,9 +40,9 @@ main = scenario do
|
||||
fromAnyTemplate @T2 (toAnyTemplate t1) === None
|
||||
fromAnyTemplate @T2 (toAnyTemplate t2) === Some t2
|
||||
fromAnyTemplate @T1 (toAnyTemplate t2) === None
|
||||
fromAnyTemplate @(GenericT T1) (toAnyTemplate gT1) === Some gT1
|
||||
fromAnyTemplate @(GenericT T2) (toAnyTemplate gT1) === None
|
||||
fromAnyTemplate @GT1 (toAnyTemplate gT1) === Some gT1
|
||||
fromAnyTemplate @GT2 (toAnyTemplate gT1) === None
|
||||
fromAnyTemplate @T1 (toAnyTemplate gT1) === None
|
||||
fromAnyTemplate @(GenericT T2) (toAnyTemplate gT2) === Some gT2
|
||||
fromAnyTemplate @(GenericT T1) (toAnyTemplate gT2) === None
|
||||
fromAnyTemplate @GT2 (toAnyTemplate gT2) === Some gT2
|
||||
fromAnyTemplate @GT1 (toAnyTemplate gT2) === None
|
||||
fromAnyTemplate @T2 (toAnyTemplate gT2) === None
|
||||
|
@ -56,6 +56,6 @@ test = scenario do
|
||||
let fact = Fact with owner = alice; name = "Answer"; value = 23
|
||||
let prop = Proposal with asset = fact; proposers = [bob]; receivers = [alice]
|
||||
propId <- submit bob do create prop
|
||||
(propId', prop') <- submit bob do fetchByKey @(Proposal Fact (Party, Text)) ([bob], (alice, "Answer"))
|
||||
(propId', prop') <- submit bob do fetchByKey @ProposalFact ([bob], (alice, "Answer"))
|
||||
propId' === propId
|
||||
prop' === prop
|
||||
|
@ -176,7 +176,7 @@ instance IouInstance where
|
||||
|
||||
|
||||
-- The instantiation of the generic `Proposal a` template for `a = Iou`
|
||||
-- in its deugared form.
|
||||
-- in its desugared form.
|
||||
type ProposalIou = Proposal Iou -- ^ TEMPLATE_INSTANCE
|
||||
|
||||
instance ProposalInstance Iou where
|
||||
|
@ -36,11 +36,11 @@ test = scenario do
|
||||
propId <- submit bank do
|
||||
create prop
|
||||
(propId', prop') <- submit bank do
|
||||
fetchByKey @(Proposal Iou) ([bank], "present")
|
||||
fetchByKey @ProposalIou ([bank], "present")
|
||||
propId' === propId
|
||||
prop' === prop
|
||||
mbPropId <- submit bank do
|
||||
lookupByKey @(Proposal Iou) ([bank], "present")
|
||||
lookupByKey @ProposalIou ([bank], "present")
|
||||
mbPropId === Some propId
|
||||
iouId <- submit alice do
|
||||
exercise propId Accept
|
||||
|
@ -24,7 +24,11 @@ HEAD — ongoing
|
||||
- [DAML Tool - Visual]
|
||||
Adding `daml damlc visual-web` command. visual-command generates webpage with `d3 <https://d3js.org>`_ network.
|
||||
+ [DAML Ledger Integration Kit] The transaction service is now fully tested.
|
||||
- [DAML Compiler] Fix a problem where constraints of the form `Template (Foo t)` caused the compiler to suggest enabling the `UndecidableInstances` language extension.
|
||||
- [DAML Compiler] Fix a problem where constraints of the form ``Template (Foo t)`` caused the compiler to suggest enabling the ``UndecidableInstances`` language extension.
|
||||
- [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``.
|
||||
|
Loading…
Reference in New Issue
Block a user