alt-romes / hegg

Fast equality saturation in Haskell
https://hackage.haskell.org/package/hegg
BSD 3-Clause "New" or "Revised" License
75 stars 8 forks source link

Make e-graph abstract #5

Closed alt-romes closed 2 years ago

alt-romes commented 2 years ago

Closes #3

As described in the comment https://github.com/alt-romes/hegg/issues/3#issuecomment-1229048536, the solution to providing the abstract definition of e-graphs while still allowing other library modules and analysis implementations to modify the structure of the e-graph (e.g. the nodes in a class) is to have Data.Equality.Graph.Lenses as the one true way to do so.

CC @aspiwack

aspiwack commented 2 years ago

After https://github.com/alt-romes/hegg/issues/3#issuecomment-1229417534 I rescind on my previous remark and agree that #3 should be closed by this issue.

alt-romes commented 2 years ago

Great.

The benefit of only-exposing-some-lenses approach is that not everything is leaked (i.e. the work list) and we indeed keep the flexibility to alter the structure in analysis. It's also in a separate module so the user who doesn't need additional capabilities won't see them in the e-graph module.

As for other-modules: I see your point, we can export it without documentation, meaning someone who do needs it can import it and read the documentation inline.

I'll patch the other-modules thing and merge

We can later revise this decision of abstraction, but for now this is a nice clean up that doesn't sacrifice anything

Thanks!