Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This sounds almost like you've just invented Haskell-like `IO`.

All operations get "queued up" in IO and only run "at the end of the world".

To write your program you `flatMap` over the `IO`: An `IO` contains the computation(s) that will run at some point, but you can map on the result of them right away, and return another `IO` value; than `flatten` the `IO[IO]` data structure (which makes `flatMap`). In Haskell you have extra syntax for `flatMap` called "do notation". In Scala, where there are library solutions for `IO`, you can use "for comprehensions" instead. In both cases the nested `flatMap` calls get sequenced. This way and you can write code almost like a consecutive chain of imperative procedure calls but it all gets "queued up" and the whole program only runs when the `IO` data structure gets evaluated by the runtime ("at the end of the world", as last call in your program).

But that's not really related to data flow.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: