Skip to content
This repository has been archived by the owner on Feb 14, 2021. It is now read-only.
/ scalaz-reactive Public archive

A high-performance, purely-functional library for reactive programming based on efficient incremental computation

License

Notifications You must be signed in to change notification settings

scalaz/scalaz-reactive

Repository files navigation

scalaz-reactive

Gitter

Goal

A high-performance, purely-functional library for reactive programming based on efficient incremental computation.

Introduction

This library aims at faithfully implementing Functional Reactive Programming as defined in [2]. The term Reactive programming is often used to describe composing streams of discrete events. Functional reactive programming (FRP) is about composing dynamic values changing in continuous time and reacting to discrete events.

Core concepts

Behaviour[A](value: Reactive[TimeFun[A]]) - value chaninging over time.

Event[ A](value: Future[Reactive[A]]) - stream of (Time, a) pairs.

Reactive[ A](head: A, tail: Event[A]) - reactive value.

Sink[A, B](f: A => IO[Void, Unit]) - consumer of reactive values.

Example

This project is just starting, so the working example is quite simple:

case class Tick(name: String)

  def ticks(interval: Duration, name: String): Event[Tick] =
    Event(IO.point { (Time.now, Reactive(Tick(name), ticks(interval, name).delay(interval))) })

  def myAppLogic: IO[Void, Unit] =
    Sink[Tick, Unit](t => IO.now(println(s"tick ${t.name}")))
      .sink(
        ticks(0.2 second, "a")
          .merge(ticks(0.4 second, "b"))
      )

This program produces a scalaz.zio.IO that can be run by e.g. scalaz.zio.App - see TwoTickers.scala in examples.

Background

About

A high-performance, purely-functional library for reactive programming based on efficient incremental computation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages