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
{{ message }}
This repository was archived by the owner on Jul 13, 2025. It is now read-only.
Provide a generalized pipe/compose metaprogramming infrastructure.
pipe.do=Tuple('do','fn');// One element tuple as a tagpipe.await=pipe.do((p,fn)=>Promise.await(p));
Whenever pipe() (or compose) encounters do, it will evaluate all the functions to the left of the do statement and compose the functions to the right into a single function; passing the value and the functions into the function stored inside to.
Do alone would allow for some interesting transformations on pipe; e.g. do(ifdef) would early abort pipe execution and do(map) would actually introduce loops as part of the function composition infrastructure.
Actually, I believe this would be about as general as the haskell do monad (hence the name) while staying in the fully functional framework.
This is different from the do syntax mostly because this uses explicit connectives instead of type dependent connectives as monads to (on the other hand this could be remedied with a type class).
Of course, how practical this is would have to be evaluated but the basic use case with await is in my definetly useful.