-
-
Save serefarikan/91ab342f263e5f2078812dc02bbc9bf3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let addChild updateNode addNode value parent = | |
match withNewChild value parent with | |
| None -> async.Return None | |
| Some (newParent, child) as path -> | |
async { do! addNode child | |
do! updateNode newParent | |
return Some child } | |
let addChildById getNode updateNode addNode logAction value parentId = | |
async { let! parent = getNode parentId | |
let! childOpt = addChild updateNode addNode value parent | |
match childOpt with | |
| None -> return None | |
| Some child -> | |
let action = AddNode { value = value; nodeId = nodeId; leafId = child.id } | |
do! logAction action | |
return Some child.id } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment