diagnose icon indicating copy to clipboard operation
diagnose copied to clipboard

Remove dependency on unordered-containers

Open 414owen opened this issue 1 year ago • 3 comments
trafficstars

This lightens the dependency footprint of diagnose by dropping the dependency on unordered-containers.

414owen avatar Jan 07 '24 12:01 414owen

This dependency removal seems less clear than the others. Some sort of Map is what’s desired here, so implementing the relevant functions locally on top of [] seems like the wrong way to go.

Maybe an argument could be made to use a Map (probably lazy?) from containers instead, since it’s already in the dependency graph and included with GHC anyway?

But restricting existing [] to NonEmpty when possible seems like a good change.

sellout avatar Jul 14 '24 14:07 sellout

If it's just groupOn, then I would prefer a local implementation (or one imported from a lightweight library like extra), to using unordered-containers, but that's very much a personal preference. You can close this issue if you prefer another side of the trade-off :)

414owen avatar Jul 15 '24 07:07 414owen

Hello, sorry for the long silence.

I don't really know why I used unordered-containers in the first place, where it is used now. It most likely came with a bit more usage here and here, which I may have removed over the years. Now the remaining uses of HashMaps do not really rely on the invariants of the structure itself: using Map instead of HashMap everywhere should not pose a problem. Not sure if those maps should be lazy or not though. It may perhaps be better for the map storing file contents, but not for those storing markers in the rendering.

Mesabloo avatar Jul 15 '24 08:07 Mesabloo