ku-fpg / data-reify

Reification of data structures using observable sharing
Other
28 stars 7 forks source link

Why all the MVars? #10

Open treeowl opened 6 years ago

treeowl commented 6 years ago

It's not at all obvious to me why we need MVars here. Why not just use StateT to handle the state of the computation? Is there some way for mapDeRef to exploit this through concurrency or lazy IO? If so, that should be documented. If not, let's simplify them away.

treeowl commented 6 years ago

Even if we really do need concurrency variables here for some reason, we can at least generate the uniques in a more performant way. Atomically reading and incrementing a counter should be cheaper than mucking about with an MVar.

andygill commented 6 years ago

This is code written 10 years ago. I can't remember. However, if it can be rewritten using StateT, then all power to you. I'm happy reviewing changes, and there are already tests that can be used.