我想在Haskell学习FRP,但是决定使用哪个图书馆有点困难。 许多尝试似乎已经失败,有些似乎又复活了(比如最近在Yampa上的活动)。

据我所知,似乎有两种“类型”的FRP:一边是推拉FRP(就像在反应香蕉和反射),另一边是箭头FRP(就像在Yampa)。在Fran和FrTime的时代,似乎也有一些“经典的FRP”,但我没有发现这些最近的活动。

这两种(或三种)FRP的方法真的从根本上不同吗? 其中一个是过时的理论,而另一个将是“未来的东西”? 或者它们必须并行发展,以达到不同的目的? 我是否列出了每个类别中最突出的库,或者是否考虑了其他选项(如Sodium, Netwire等)?


我终于看了J. Abrahamson在评论中推荐的[Evan Czaplicki的演讲](https://www.youtube.com/watch?v=Agu6jipKfYw)。这很有趣,也帮我理清了一些事情。我强烈推荐给任何觉得这个问题有趣的人。


我访问了Haskell.org网站来调查你的问题。我发现了两篇重要的论文,你应该阅读这些论文来进一步研究,我正在从这些学术论文中构建我对你问题的答案。

由Conal Elliott设计的推拉式玻璃钢

John Hughes将单子概括为箭头


Yes, but also no. According to Elliot, push is data driven FRP evaluation and pull relates to what is called "demand" driven evaluation. The author recommends pull because push tends to idle in between data inputs. Here's the crux: push-pull combines and balances these behaviors for the chief purpose of minimizing the need to recompute values. It's simple; operating FRP with push-pull hastens the ability to react. Arrow is a different technique for using abstract types to link values and evaluate them simultaneously. All these concepts are fundamentally different. But don't take my word for it: The nature of the Arrow interface is problematic for the goal of minimal re-evaluation. Input events and behaviors get combined into a single input, which then changes whenever any component changes, (Elliott). Thus, Arrow contradicts the goal of push-pull. That does not mean you can't use all of these at once, just that it would be complex, and there are some things you cannot compute without abstract Arrow types. I have not found scholarly opinions on which approaches are "the way of the future." Only note that arrows can handle simultaneity particularly well. If you could implement arrows and use push-pull to minimize computations, that would be the way of the future. Yes, they address separate purposes. As I said, they can be formulated together but it is difficult to implement and even if it does work, it would probably negate the reactive speed benefits of push-pull. That's subjective, but Reactive and Yampa appear to be the most commonly cited language libraries for FRP. I would say Reactive by Conal Elliott has deep roots, and Yampa is established as well. Other projects like Netwire arose as replacements, but it could be awhile before they replace the giants.


希望这能有所帮助!就像我说的,阅读我指出的文章会让你更好地理解箭头、推和拉之间的语义距离。