Giter Club home page Giter Club logo

purescript-hareactive's People

Contributors

paldepind avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

zenleaf

purescript-hareactive's Issues

How to produce events. Examples.

It would be nice to have couple simple examples:

  1. How to produce Stream from keyboard events. (Is there some "streamFromEvent" from hareactive counterpart?)
  2. How to "subscribe" Stream to do some Effect.

Thx.

Running Aff and timing

@erisco asked on the PureScript Slack wether or not runStreamAff runs Affs in parallel or sequentially. This made me realize that there is no way to control that currently. @limemloh and I have discussed it and this is what I propose.

We will have two ways of running Affs from streams. One, runStreamAff which runs effects in parallel and an alternative runStreamAffPar which takes an integer n specifying that only n threads may run in parallel. Then runStreamAff is essentially the same as runStreamAffPar Infinity and runStreamAffPar 1 runs the Affs completely sequentially.

These are the types:

runStreamAff :: forall a. Stream (Aff a) -> Now (Stream (Future (Either Error a)))
runStreamAffPar :: forall a. Int -> Stream (Aff a) -> Now (Future (Either Error a))

Unlike the current runStreamAff these delivers their result as Futures. To flatten and order these we will add the following functions:

joinFutures :: forall a. Stream (Future a) -> Stream a
joinFuturesLatest :: forall a. Stream (Future a) -> Stream a
joinFuturesOrdered :: forall a. Stream (Future a) -> Stream a

The first simply delivers the result as they come back, the second discards old results (what you want for the zip code example) and the last one delivers results in the same order that they came in, delaying results if some preceding Affs are slow.

Does this handle all the different orderings that one may want? What do you think @erisco?

Add a way to flatten a stream of arrays of events into a stream of events

Hello!

Currently, I have this thing in my code:

flattenArrayStream :: forall a. Stream (Array a) -> Now (Stream a)
flattenArrayStream input = do
  ss <- liftEffect sinkStream'
  liftEffect $ subscribe (foldMap (\x -> pushSink x ss.sink)) input
  pure ss.stream

Perhaps a new combinator that does something like this the "proper" way (perhaps without using Effect?) would be useful?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.