Module Daml.Trigger.Internal

Data Types

data ACS

Active contract set, you can use getContracts to access the templates of a given type.


Field Type Description
activeContracts [(AnyContractId, AnyTemplate)]  
pendingContracts Map CommandId [AnyContractId]  

instance HasField “acs” (TriggerState s) ACS

instance HasField “activeContracts” ACS [(AnyContractId, AnyTemplate)]

instance HasField “initialize” (Trigger s) (ACS -> s)

instance HasField “pendingContracts” ACS (Map CommandId [AnyContractId])

instance HasField “rule” (Trigger s) (Party -> ACS -> Time -> Map CommandId [Command] -> s -> TriggerA ())

instance HasField “updateState” (Trigger s) (ACS -> Message -> s -> s)

data TriggerA a

TriggerA is the type used in the rule of a DAML trigger. Its main feature is that you can call emitCommands to send commands to the ledger.

TriggerA (State TriggerAState a)

instance Functor TriggerA

instance Action TriggerA

instance Applicative TriggerA

instance HasField “rule” (Trigger s) (Party -> ACS -> Time -> Map CommandId [Command] -> s -> TriggerA ())

data TriggerAState


Field Type Description
commandsInFlight Map CommandId [Command]  
emittedCommands [Commands] Emitted commands in reverse because I can’t be bothered to implement a dlist.
pendingContracts Map CommandId [AnyContractId] Map from command ids to the contract ids marked pending by that command.
nextCommandId Int Command id used for the next submit

instance HasField “commandsInFlight” TriggerAState (Map CommandId [Command])

instance HasField “emittedCommands” TriggerAState [Commands]

instance HasField “nextCommandId” TriggerAState Int

instance HasField “pendingContracts” TriggerAState (Map CommandId [AnyContractId])

data TriggerState s


Field Type Description
acs ACS  
party Party  
userState s  
commandsInFlight Map CommandId [Command]  
nextCommandId Int  

instance HasField “acs” (TriggerState s) ACS

instance HasField “commandsInFlight” (TriggerState s) (Map CommandId [Command])

instance HasField “nextCommandId” (TriggerState s) Int

instance HasField “party” (TriggerState s) Party

instance HasField “userState” (TriggerState s) s


: Map CommandId [Command] -> Commands -> Map CommandId [Command]
: AnyContractId -> AnyTemplate -> ACS -> ACS
: a -> a
: AnyContractId -> ACS -> ACS
: Template a => AnyContractId -> ACS -> Optional a
: Event -> ACS -> ACS
: Transaction -> ACS -> ACS
: (Party -> ACS -> Time -> Map CommandId [Command] -> s -> TriggerA ()) -> Time -> TriggerState s -> (TriggerState s, [Commands])
: TriggerA a -> TriggerAState -> (a, TriggerAState)