purescript-react-basic-hooks
purescript-react-basic-hooks copied to clipboard
SuspenseStore refactor to allow caching of any HasBackend instance members
The old store required the key and value types of the cache to be defined at cache creation. This refactor is to allow any type implementing HasBackend to be stored in the cache in a (hopefully) type-safe way.
The main bits I'd like feedback on:
- does the
HasBackendclass behave correctly, i.e. do the functional dependencies correctly prevent invalid instances?- an instance is invalid if a given key,
k, can be used in multiple instances with a differentsorv - storing the same entity type using different key types is fine, but it should be impossible to cause overlapping
svalues across different choices forv.. does that make sense? - put another way,
sneeds to be unique for each choice ofv
- an instance is invalid if a given key,
- the
HasBackendimplementations are carried into the cache using a few internal classes,ToKey,ToAffUnsafe, andHasOpaque, usingStorable-- do these make sense? - any better ways to accomplish this?
The suspense on this one is killing me!
@i-am-the-slime tbh I'm not sure when I'll get to this. My new day job isn't using PS and I'm a bit burnt out on the after hours programming. Maybe someday inspiration will strike, but in the meantime I'll do my best to review and merge any work others want to contribute to this.
@spicydonuts It's quite sad that your new job does not use PS. All good, please take all the time you need for yourself and only do this when you really feel like it! Your physical and mental health(s?) will thank you for it.