fgl
                                
                                 fgl copied to clipboard
                                
                                    fgl copied to clipboard
                            
                            
                            
                        Introduce lookup options when inserting node in a NodeMap
This is a try to fix #72 .
The main new function is mkLookupNode, which is mkNode plus a Boolean saying if the node was already present.
I also added a member-like function.
I'm wondering whether it might be worth defining a new type isomorphic to Bool to make it clear what the result it (does True mean "added in" or "already present"?).
It might worth it, you are right. Seems a bit overkill for two functions. I don't know if lookup counter-part functions can be made/are interesting in NodeMap
I am also wondering if a direct lookup version of insNode and maybe insEdge were interesting in the Graph module... They can be easily optimized in PatriciaTree
Is there anything preventing this from being pulled? I'm looking for this exact functionality.
The only thing I'd like to add is that -- while we're at it -- it would be nice to also have the corresponding monadic versions of e.g. lookupNode:
lookupNodeM :: (Ord a) => a -> NodeMapM a b g (Maybe Node).
I also need this function :)
Is there still interest in this functionality? If so, I will merge this PR.
This is useful for quickly getting nodes from the label set.