You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to start by saying really enjoy this library for it's simplicity and well written type signatures. Many of the other options that try to introduce fp optics include way too much overhead and stop feeling like typescript.
One issue I am running into is that my lenses often lookup data that may very well be undefined and that is not a failure in the prism sense but a perfectly valid value. Can we use a sentinel value (like Prism.FAIL) or similar to require get to explicitly state the intent to fail? This way Lens can still share all of the Prism constructors/composition/etc while still allowing undefined as a valid value. I am a huge fan of the type union approach over wrapping the result in optional or similar in Prism's get and so I think this must stay.
Mainly this breaks during composition but I've been putting together some utilities as well (like filter) that also run into this problem as they use Prismish so we lose the | undefined from the actual projection type.
I would be happy to submit a PR for this if you agree it is a worth-while breaking API change, as I do :)
The text was updated successfully, but these errors were encountered:
I would like to start by saying really enjoy this library for it's simplicity and well written type signatures. Many of the other options that try to introduce fp optics include way too much overhead and stop feeling like typescript.
One issue I am running into is that my lenses often lookup data that may very well be undefined and that is not a failure in the prism sense but a perfectly valid value. Can we use a sentinel value (like
Prism.FAIL
) or similar to requireget
to explicitly state the intent to fail? This wayLens
can still share all of thePrism
constructors/composition/etc while still allowingundefined
as a valid value. I am a huge fan of the type union approach over wrapping the result in optional or similar in Prism'sget
and so I think this must stay.Mainly this breaks during composition but I've been putting together some utilities as well (like
filter
) that also run into this problem as they usePrismish
so we lose the| undefined
from the actual projection type.I would be happy to submit a PR for this if you agree it is a worth-while breaking API change, as I do :)
The text was updated successfully, but these errors were encountered: