Functional Reactive Programming in Scala [closed]
Asked Answered
A

8

56

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

Alboin answered 28/6, 2009 at 3:35 Comment(1)
W
43

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

Weirdo answered 10/8, 2010 at 12:40 Comment(5)
This paper is actually very good. It really made me understand what is all the fuzz in FRP all about...Gelatinoid
here is new version.Fulvous
Also see https://mcmap.net/q/130284/-why-should-the-observer-pattern-be-deprecated/403455Acetylene
@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.Banquet
What's the status of Scala.React? github.com/ingoem/scala-reactSmitten
O
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.

Offen answered 27/1, 2011 at 6:13 Comment(7)
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.Leannleanna
@Leannleanna - that's interesting. Where do you use applicatives? P.S. Do you have a Swing bridge that's shareable?Offen
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.Leannleanna
How is Signal an applicative?Offen
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)(_ + _).Leannleanna
Ah thanks for the info. If you like, feel free to open an issue to add applicative syntax.Offen
@Leannleanna just added it. github.com/nafg/reactive/commit/…Offen
S
9

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

Stirling answered 7/2, 2013 at 7:46 Comment(1)
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.Aoristic
G
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.

Gustative answered 27/4, 2014 at 20:33 Comment(0)
M
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.

Marchal answered 28/6, 2009 at 4:9 Comment(0)
S
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.

Smitten answered 7/12, 2013 at 8:58 Comment(0)
H
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.

Hegel answered 21/6, 2011 at 3:17 Comment(0)
D
0

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

Dawnedawson answered 28/4, 2018 at 11:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.