I have just discovered that you can use guards in the `case` pattern
- gyorgybalazsiOP 5
Might be useful for other Daml-ers as well.
Source: dablchat/V3.daml at e648049b6d74805ed85154518ab7a89194326d2a · digital-asset/dablchat · GitHub
- anthony 2
Great 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
