purescript-react-basic-hooks icon indicating copy to clipboard operation
purescript-react-basic-hooks copied to clipboard

SuspenseStore refactor to allow caching of any HasBackend instance members

Open maddie927 opened this issue 5 years ago • 3 comments

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 HasBackend class 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 different s or v
    • storing the same entity type using different key types is fine, but it should be impossible to cause overlapping s values across different choices for v.. does that make sense?
    • put another way, s needs to be unique for each choice of v
  • the HasBackend implementations are carried into the cache using a few internal classes, ToKey, ToAffUnsafe, and HasOpaque, using Storable -- do these make sense?
  • any better ways to accomplish this?

maddie927 avatar Jul 23 '20 02:07 maddie927

The suspense on this one is killing me!

i-am-the-slime avatar Jul 24 '21 09:07 i-am-the-slime

@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.

maddie927 avatar Aug 05 '21 22:08 maddie927

@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.

i-am-the-slime avatar Aug 06 '21 08:08 i-am-the-slime