Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. let addChild updateNode addNode value parent =
  2. match withNewChild value parent with
  3. | None -> async.Return None
  4. | Some (newParent, child) as path ->
  5. async { do! addNode child
  6. do! updateNode newParent
  7. return Some child }
  8.  
  9. let addChildById getNode updateNode addNode logAction value parentId =
  10. async { let! parent = getNode parentId
  11. let! childOpt = addChild updateNode addNode value parent
  12. match childOpt with
  13. | None -> return None
  14. | Some child ->
  15. let action = AddNode { value = value; nodeId = nodeId; leafId = child.id }
  16. do! logAction action
  17. return Some child.id }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement