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

Async Type Checking #136

Open
JAForbes opened this issue Apr 25, 2017 · 2 comments
Open

Async Type Checking #136

JAForbes opened this issue Apr 25, 2017 · 2 comments

Comments

@JAForbes
Copy link
Member

I propose we support a new function defAsync that merely states the result is an asynchronous value (we could parameterize what an async result looks like).

Why?

If the user can tell sanctuary-def that a function is async, it could open up this library to moving type checking to a worker thread (in the browser), or a child process (in node). It gives sanctuary-def permission to do exhaustive checks on recursive types or complex constraints without blowing the stack, simply by recurring asynchronously.

If we can move type checking off the main thread, we could keep type checking on in production without experiencing jank in the UI.

We'd also potentially allow sanctuary-def to give us better verification of async results, by allowing sanctuary-def to traverse async results when they eventually arrive.

I'd be happy to tinker with this on another branch if it seems like something we may want. Even if doesn't work out, it could be an interesting experiment.

@davidchambers
Copy link
Member

This is an interesting idea. Please tinker. :)

@gabejohnson
Copy link
Member

An alternative to having a new definition function would be to annotate a type w/ an async flag. Then if a checked function has a return type that is async, Sanctuary could do its webworker magic.

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

3 participants