Functional Reactive Programming in Scala

22,718

Solution 1

See also Odersky et al.'s paper "Deprecating the Observer Pattern". It explains the library Scala.React, which was developed for the paper.

Solution 2

There's reactive -- http://github.com/nafg/reactive. The repository currently contains two projects. reactive-core is a standalone FRP library. reactive-web builds on it to make it very easy to make very dynamic and interactive Lift webapps.

Solution 3

There is scala-reactive: http://github.com/erikrozendaal/scala-reactive

It is inspired by Microsoft's Reactive Extensions library, with an Observable trait taking the place of IObservable, and tailored to the Scala collections API as much Rx is to the LINQ API.

Share:
22,718
Daniel C. Sobral
Author by

Daniel C. Sobral

I have been programming for more than 20 years now, starting with 8 bits computers, assembler and BASIC. My passion for languages meant that, by the time I entered college, I had already programmed for fun or profit in more than 20 languages, including odd ones like Forth, MUMPS and APL, as well as theoretically important ones like Lisp and Prolog. Some of my code ended up in FreeBSD, of which I was a committer for some years, while I got my masters degree in the field of distributed algorithms. I also contributed to Scala, with small amounts of code, some reasonable amount of documentation, and a couple of years of a lot of attention to the Scala questions on Stack Overflow.

Updated on April 29, 2020

Comments

  • Daniel C. Sobral
    Daniel C. Sobral almost 4 years

    Are there any libraries written for Scala enabling Functional Reactive Programming?

  • Roland Tepp
    Roland Tepp over 13 years
    This paper is actually very good. It really made me understand what is all the fuzz in FRP all about...
  • Mariusz Pawelski
    Mariusz Pawelski over 11 years
    here is new version.
  • Jeff Axelrod
    Jeff Axelrod over 11 years
  • Shelby Moore III
    Shelby Moore III over 11 years
    @DanielC.Sobral I provided an example for inverting the control of state using Scala's delimited continuations, not just inversion-of-control of caller/callee, which afaics that paper and Scala.React don't do.
  • Owen
    Owen about 11 years
    I tried reactive-core in a Swing GUI and found it quite pleasant to use. The biggest pain is actually language related -- Scala could use nicer syntax for applicatives.
  • nafg
    nafg about 11 years
    @Owen - that's interesting. Where do you use applicatives? P.S. Do you have a Swing bridge that's shareable?
  • Owen
    Owen about 11 years
    Signal is an applicative. And I didn't use any sort of bridge; I just mixed reactive code in with Swing code -- a little messy since the swing components are so stateful, but usable. The whole thing will be on github eventually.
  • nafg
    nafg about 11 years
    How is Signal an applicative?
  • Owen
    Owen about 11 years
    pure is a constant signal, and ap is doing a zip followed by a map. So if say I have a signal x and a signal y and I want a signal x + y, x zip y map { case (x, y) => x+y } is like scalaz (x |@| y)(_ + _).
  • nafg
    nafg about 11 years
    Ah thanks for the info. If you like, feel free to open an issue to add applicative syntax.
  • Vadzim
    Vadzim over 10 years
  • nafg
    nafg almost 10 years