56

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

Daniel C. Sobral
  • 284,820
  • 82
  • 479
  • 670

8 Answers8

43

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

Ilya Kogan
  • 20,368
  • 15
  • 78
  • 134
magicduncan
  • 1,376
  • 1
  • 10
  • 11
  • 3
    This paper is actually very good. It really made me understand what is all the fuzz in FRP all about... – Roland Tepp Nov 09 '10 at 08:46
  • 11
    [here](http://infoscience.epfl.ch/record/176887) is new version. – Mariusz Pawelski Sep 05 '12 at 22:02
  • Also see http://stackoverflow.com/q/11619680/403455 – Jeff Axelrod Oct 17 '12 at 18:47
  • 1
    @DanielC.Sobral I provided [an example](http://stackoverflow.com/a/13236109/615784) 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. – Shelby Moore III Nov 05 '12 at 18:39
  • [What's the status of Scala.React?](http://stackoverflow.com/questions/5095728/whats-the-status-of-scala-react) https://github.com/ingoem/scala-react – Vadzim Dec 04 '13 at 07:54
12

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.

nafg
  • 2,059
  • 23
  • 22
  • 1
    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. – Owen Apr 06 '13 at 07:59
  • @Owen - that's interesting. Where do you use applicatives? P.S. Do you have a Swing bridge that's shareable? – nafg Apr 08 '13 at 04:36
  • `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. – Owen Apr 08 '13 at 07:37
  • 1
    How is Signal an applicative? – nafg Apr 09 '13 at 08:22
  • 2
    `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)(_ + _)`. – Owen Apr 09 '13 at 13:52
  • Ah thanks for the info. If you like, feel free to open an issue to add applicative syntax. – nafg Apr 11 '13 at 04:36
  • 1
    @Owen just added it. https://github.com/nafg/reactive/commit/593a7710dc217501afcc4fc6d167114b7bff8b10 – nafg Jul 10 '14 at 08:31
9

https://github.com/Netflix/RxJava Functional Reactive Programming library for the JVM, developed by Netflix.

Mairbek Khadikov
  • 7,449
  • 3
  • 33
  • 50
  • 2
    Rx (Reactive Extensions) is not "functional reactive programming" in the FRP sense, although you could argue that it is both functional and reactive in the general sense. – tunesmith May 10 '15 at 18:43
9

There is Scala.Rx by Li Haoyi. In short, it aims to be a simpler, easy-to-use and more interoperable reimagination of (parts of) Scala.React.

Don't be misled by the Rx suffix. Scala.Rx has little to do with Reactive Extensions from .NET. Scala.Rx does not focus so much on asynchrony and event streams as rather time-varying values and the expression of functional dependencies with automatic change propagation.

Eugen
  • 2,670
  • 2
  • 24
  • 28
8

I don't Scala so don't know how good these are but here is a blog with comments that talk about FRP in scala: Functional Reactive Programming (FRP) in Scala (Fresca, ScalaFX) and here is the reddit that shows a stackoverflow conversation that led me to the above link.

I'd have a few questions about the FRP capabilities in Scala. What is
the current status of ScalaFX? isn't updated since 3 months... Is it currently usable?

It is definitely usable, there is just not an official release yet.

Are there any other FRP frameworks coming up (e.g. Fresca reborn)?

Fresca was my very first attempt at FRP in Scala. SFX as it is currently in trunk improves on Fresca in several aspects and as such can be seen as a successor to Fresca.

Eugene Yokota
  • 90,473
  • 43
  • 204
  • 301
DouglasH
  • 1,176
  • 8
  • 12
7

Coursera Principles of Reactive Programming course promotes RxScala.

RxScala brings Reactive Extensions to Scala. Rx was first implemented for .NET, and is now being implemented in Java. The RxScala project is an adaptor for RxJava. Its code is in a subdirectory the RxJava repository.

This library is not yet finished. You have to expect breaking changes in future versions.

Vadzim
  • 21,258
  • 10
  • 119
  • 142
5

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.

Allan Erskine
  • 379
  • 4
  • 4
0

You have many many libraries. Here you have a list of many of them https://github.com/politrons/reactiveScala

paul
  • 10,286
  • 17
  • 68
  • 115