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
As we discussed in the previous issue, using a "continuation passing style" seems to be the most natural js solution for further transformations, i.e.:
optional(string,s=>s??'')
As a side note, this is for all intents and purposes function composition, in pseudo code: optional(string) >> (s => s ?? ''). Since there is no good way of doing this in js directly, this seems like a good compromise.
This is how field and fields already work, and I imagine it will work well with optional, array, record and so on. Unfortunately I don't think it would work with union, as that function already uses variadic overloads and I don't see a way to shoehorn this into it. Not sure if there are more of these cases? It's not a huge problem, just maybe confusing to the user - consistency in the api is good for discoverability.
The text was updated successfully, but these errors were encountered:
As we discussed in the previous issue, using a "continuation passing style" seems to be the most natural js solution for further transformations, i.e.:
As a side note, this is for all intents and purposes function composition, in pseudo code:
optional(string) >> (s => s ?? '')
. Since there is no good way of doing this in js directly, this seems like a good compromise.This is how
field
andfields
already work, and I imagine it will work well withoptional
,array
,record
and so on. Unfortunately I don't think it would work withunion
, as that function already uses variadic overloads and I don't see a way to shoehorn this into it. Not sure if there are more of these cases? It's not a huge problem, just maybe confusing to the user - consistency in the api is good for discoverability.The text was updated successfully, but these errors were encountered: