Closed jamievicary closed 4 years ago
The hope is to just build diagrams in a way which reuses memory in a sensible way (à la memoization) rather than having to do this hack
I wouldn't call it a hack, I would call it an optimization. But anyway, I agree it's better to do this on object creation. This seems like a standard requirement for functional programs -- I wonder if there are any existing PureScript techniques for achieving this.
To be clear, I am assuming that currently, if you call a constructor twice with exactly the same arguments, you will get back two different instances of the type being constructed -- can you confirm that's the case.
I guess this is relevant: https://pursuit.purescript.org/packages/purescript-memoize/5.0.0/docs/Data.Function.Memoize
The data structure needs to be decycled and deduplicated after every interaction.
(Not necessary for the initial working version.)