I have just discovered that you can use guards in the `case` pattern
App Development2 posts292 views7 likesLast activity Mar 2021
GY
gyorgybalazsiOP
Mar 2021Might be useful for other Daml-ers as well.
Source: dablchat/V3.daml at e648049b6d74805ed85154518ab7a89194326d2a · digital-asset/dablchat · GitHub
AN
anthony
Mar 2021Great tip, here’s the text version for easier reading / searching
case optAliasCid of
Some cid | alias /= "" -> do
newCid <- exercise cid SelfAlias_Rename with newAlias = alias
return $ Some newCid
Some cid | alias == "" -> do
archive cid
return None
None | alias /= "" -> do
cid <- create SelfAlias with ..
return $ Some cid
_ -> return None
