Open mitchellwrosen opened 8 years ago
This might show a use case, which requires exporting some new functionality. E.g., a different "focus" function. This I will support and will merge a PR. If you're willing to do it, it's best to discuss the design first.
I will not support introducing the "Internals" module, since I am strongly opposed to that convention generally. As an alternative to that I would support releasing the internal HAMT datastructure in a separate library, which I even would do at some point either way, but it would require a heavy revision of all the codebase, and I just don't have the time for that right now.
Also it seems like what you need is already achievable with the current API:
multiMapDelete :: (Association k v) => v -> k -> Multimap k v -> STM Bool
multiMapDelete =
Multimap.focus deleteInforming
deleteInforming :: Applicative m => Focus.StrategyM m a Bool
deleteInforming =
pure . liftA2 (,) isJust (const Focus.Remove)
Oh, so it is possible after all :)
Thanks!
And +1 to releasing the HAMT codebase as a separate library, if you find the time. I don't understand it well enough to help out any :)
Might be useful to export the constructors of these data structures.
I'd like to implement a version of
delete
that tells me whether or not anything was deleted, but I don't believe this is possible with the current API:Or something along those lines. Anyways, to implement this, I need access to the internals.