Function for extracting nested values in a type safe way.
It happens, sometimes I have nested types and I just need the value, and due to other conditionals I know it's type safe to grab it.
But x.value.value.value.value[property]
is brittle, and it's hard to see if there's enough or too few .value
's.
So I'd prefer something like this.
sst.access([Loaded, SaveState]) (x => x.file_id) ( x )
And I'd like type errors if I pass in the wrong set of types for the structure, so when I iterate on my model I know exactly what's wrong and exactly what to fix.
Maybe we can traverse cases too.
f(Maybe) ([Loaded.Y, SaveState.Unsaved]) (x => x.file_id) (x)
Which can return Maybe.N
if the value is the right type but not that exact configuration of cases. Maybe that can be a yslashn specific function.