Create an optional datatype from a normal one
App Development2 posts135 viewsLast activity Jan 2024
DI
Divyansh_Gupta_ATR10OP
Jan 2024I want to convert a data type into an optional Data type. I tried the following format:
let newOptionalAdminId = Optional newAdminId
However, I am getting the following error with this
Data constructor not in scope:
Optional : TalentId -> Optional TalentId
TalentId is the contract ID for the Template Talent. How can I convert this into an optional datatype?
CO
cocreature
Jan 2024The constructor for this is called Some, so
let newOptionalAdminId = Some newAdminId
Optional is just the name of the type.
You might also be interested in the tutorial on Daml data types Data Types — Daml SDK 2.8.0 documentation and the docs for Optional Prelude — Daml SDK 2.8.0 documentation