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

Better stream support via alias? #32

Open
kristianmandrup opened this issue Mar 6, 2017 · 0 comments
Open

Better stream support via alias? #32

kristianmandrup opened this issue Mar 6, 2017 · 0 comments

Comments

@kristianmandrup
Copy link

For FRP, look at various frp solutions

I suggest using a pipe equivalent +> for working with streams (piping). +> Could perhaps just be an alias for . but be used to make it more clear we are operating on a stream (or whatever other special construct we like to clearly differentiate from "normal" function call)

const source = getAsyncStockData();

const subscription = source
  .filter(quote => quote.price > 30)
  .map(quote => quote.price)
  .subscribe(
    price => console.log(`Prices higher than $30: ${price}`),
    err => console.log(`Something went wrong: ${err.message}`)
  );

/* When we're done */
subscription.dispose();

Could become

source: getAsyncStockData()
subscription: source
  +>filter quote -> quote.price > 30
  +>map quote -> quote.price
  +>subscribe
    price -> console.log `Prices higher than $30: \price",
    err -> console.log "Something went wrong: \err.message

# When we're done
subscription.dispose()
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