mirror of
https://github.com/digital-asset/daml.git
synced 2024-11-10 10:46:11 +03:00
hlb, no wildcard record construction (#2332)
* remove: type Status = LL.Status * no {..} in record construction
This commit is contained in:
parent
50a04397e4
commit
8b5cd613f4
@ -182,7 +182,7 @@ raiseLedgerConfiguration = \case
|
||||
LL.LedgerConfiguration{..} -> do
|
||||
minTtl <- perhaps "min_ttl" ledgerConfigurationMinTtl
|
||||
maxTtl <- perhaps "max_ttl" ledgerConfigurationMaxTtl
|
||||
return $ LedgerConfiguration {..}
|
||||
return $ LedgerConfiguration {minTtl,maxTtl}
|
||||
|
||||
raiseGetActiveContractsResponse :: LL.GetActiveContractsResponse -> Perhaps (AbsOffset,Maybe WorkflowId,[Event])
|
||||
raiseGetActiveContractsResponse = \case
|
||||
@ -210,14 +210,14 @@ raiseCompletion = \case
|
||||
LL.Completion{..} -> do
|
||||
cid <- raiseCommandId completionCommandId
|
||||
let status = completionStatus
|
||||
return Completion{..}
|
||||
return Completion{cid,status}
|
||||
|
||||
raiseCheckpoint :: LL.Checkpoint -> Perhaps Checkpoint
|
||||
raiseCheckpoint = \case
|
||||
LL.Checkpoint{..} -> do
|
||||
let _ = checkpointRecordTime -- TODO: dont ignore!
|
||||
offset <- perhaps "checkpointOffset" checkpointOffset >>= raiseAbsLedgerOffset
|
||||
return Checkpoint{..}
|
||||
return Checkpoint{offset}
|
||||
|
||||
raiseAbsLedgerOffset :: LL.LedgerOffset -> Perhaps AbsOffset
|
||||
raiseAbsLedgerOffset = \case
|
||||
@ -236,7 +236,7 @@ raiseTransactionTree = \case
|
||||
offset <- raiseAbsOffset transactionTreeOffset
|
||||
events <- raiseMap raiseEventId raiseTreeEvent transactionTreeEventsById
|
||||
roots <- raiseList raiseEventId transactionTreeRootEventIds
|
||||
return TransactionTree {..}
|
||||
return TransactionTree {trid,cid,wid,leTime,offset,events,roots}
|
||||
|
||||
raiseTreeEvent :: LL.TreeEvent -> Perhaps TreeEvent
|
||||
raiseTreeEvent = \case
|
||||
@ -252,7 +252,7 @@ raiseTreeEvent = \case
|
||||
witness <- raiseList raiseParty exercisedEventWitnessParties
|
||||
childEids <- raiseList raiseEventId exercisedEventChildEventIds
|
||||
result <- perhaps "exercisedEventExerciseResult" exercisedEventExerciseResult >>= raiseValue
|
||||
return ExercisedTreeEvent{..}
|
||||
return ExercisedTreeEvent{eid,cid,tid,choice,choiceArg,acting,consuming,witness,childEids,result}
|
||||
|
||||
LL.TreeEvent(Just (LL.TreeEventKindCreated LL.CreatedEvent{..})) -> do
|
||||
eid <- raiseEventId createdEventEventId
|
||||
@ -263,7 +263,7 @@ raiseTreeEvent = \case
|
||||
witness <- raiseList raiseParty createdEventWitnessParties
|
||||
signatories <- raiseList raiseParty createdEventSignatories
|
||||
observers <- raiseList raiseParty createdEventObservers
|
||||
return CreatedTreeEvent{..}
|
||||
return CreatedTreeEvent{eid,cid,tid,key,createArgs,witness,signatories,observers}
|
||||
|
||||
raiseTransaction :: LL.Transaction -> Perhaps Transaction
|
||||
raiseTransaction = \case
|
||||
@ -275,7 +275,7 @@ raiseTransaction = \case
|
||||
leTime <- perhaps "transactionEffectiveAt" transactionEffectiveAt >>= raiseTimestamp
|
||||
events <- raiseList raiseEvent transactionEvents
|
||||
offset <- raiseAbsOffset transactionOffset
|
||||
return Transaction {..}
|
||||
return Transaction {trid,cid,wid,leTime,events,offset}
|
||||
|
||||
raiseEvent :: LL.Event -> Perhaps Event
|
||||
raiseEvent = \case
|
||||
@ -285,7 +285,7 @@ raiseEvent = \case
|
||||
cid <- raiseContractId archivedEventContractId
|
||||
tid <- perhaps "archivedEventTemplateId" archivedEventTemplateId >>= raiseTemplateId
|
||||
witness <- raiseList raiseParty archivedEventWitnessParties
|
||||
return ArchivedEvent{..}
|
||||
return ArchivedEvent{eid,cid,tid,witness}
|
||||
LL.Event(Just (LL.EventEventCreated LL.CreatedEvent{..})) -> do
|
||||
eid <- raiseEventId createdEventEventId
|
||||
cid <- raiseContractId createdEventContractId
|
||||
@ -295,21 +295,21 @@ raiseEvent = \case
|
||||
witness <- raiseList raiseParty createdEventWitnessParties
|
||||
signatories <- raiseList raiseParty createdEventSignatories
|
||||
observers <- raiseList raiseParty createdEventObservers
|
||||
return CreatedEvent{..}
|
||||
return CreatedEvent{eid,cid,tid,key,createArgs,witness,signatories,observers}
|
||||
|
||||
raiseRecord :: LL.Record -> Perhaps Record
|
||||
raiseRecord = \case
|
||||
LL.Record{..} -> do
|
||||
let rid = recordRecordId >>= optional . raiseIdentifier
|
||||
fields <- raiseList raiseRecordField recordFields
|
||||
return Record{..}
|
||||
return Record{rid,fields}
|
||||
|
||||
raiseRecordField :: LL.RecordField -> Perhaps RecordField
|
||||
raiseRecordField = \case
|
||||
LL.RecordField{..} -> do
|
||||
let label = recordFieldLabel
|
||||
fieldValue <- perhaps "recordFieldValue" recordFieldValue >>= raiseValue
|
||||
return RecordField{..}
|
||||
return RecordField{label,fieldValue}
|
||||
|
||||
-- TODO: more cases here
|
||||
raiseValue :: LL.Value -> Perhaps Value
|
||||
@ -356,7 +356,7 @@ raiseIdentifier = \case
|
||||
pid <- raisePackageId identifierPackageId
|
||||
mod <- raiseModuleName identifierModuleName
|
||||
ent <- raiseEntityName identifierEntityName
|
||||
return Identifier{..}
|
||||
return Identifier{pid,mod,ent}
|
||||
|
||||
raiseList :: (a -> Perhaps b) -> Vector a -> Perhaps [b]
|
||||
raiseList f v = loop (Vector.toList v)
|
||||
|
@ -103,7 +103,7 @@ data LedgerOffset = LedgerBegin | LedgerEnd | LedgerAbsOffset AbsOffset
|
||||
data Completion
|
||||
= Completion {
|
||||
cid :: CommandId,
|
||||
status :: Maybe Status }
|
||||
status :: Maybe LL.Status }
|
||||
deriving (Eq,Ord,Show)
|
||||
|
||||
data Checkpoint
|
||||
@ -228,8 +228,6 @@ data Timestamp
|
||||
seconds :: Integer, -- TODO: Int64?
|
||||
nanos :: Integer } deriving (Eq,Ord,Show)
|
||||
|
||||
type Status = LL.Status
|
||||
|
||||
newtype TemplateId = TemplateId Identifier -- TODO: remove this wrapping
|
||||
deriving (Eq,Ord,Show)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user