Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transformation continuations #6

Open
tskj opened this issue Dec 19, 2021 · 0 comments
Open

Transformation continuations #6

tskj opened this issue Dec 19, 2021 · 0 comments

Comments

@tskj
Copy link
Owner

tskj commented Dec 19, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant