lux/concurrency/frp

Types

Chan

An asynchronous channel of values which may be closed.

Reading from a channel does not remove the read piece of data, as it can still be accessed if you have an earlier node of the channel.

(type: (Chan a)
  (lux/concurrency/promise;Promise (lux;Maybe [a (Chan a)])))

Macros

chan

## Makes an uninitialized Chan (in this case, of Unit).
(chan Unit)

## The type is optional.
(chan)

Structs

Applicative<Chan>

(lux/control/applicative;Applicative Chan)

Functor<Chan>

(lux/control/functor;Functor Chan)

Monad<Chan>

(lux/control/monad;Monad Chan)

Values

(as-chan p)

(All [a] (-> (lux/concurrency/promise;Promise a) (Chan a)))

(close chan)

(All [a] (-> (Chan a) (lux/codata/io;IO lux;Bool)))

(consume xs)

Reads the entirety of a channel's contents and returns them as a list.

(All [a] (-> (Chan a) (lux/concurrency/promise;Promise (lux;List a))))

(filter p xs)

(All [a] (-> (-> a lux;Bool) (Chan a) (Chan a)))

(fold f init xs)

Asynchronous fold over channels.

(All [a b] (-> (-> b a (lux/concurrency/promise;Promise a)) a (Chan b) (lux/concurrency/promise;Promise a)))

(merge xss)

Fuse all the elements in a list of channels by piping them onto a new output channel.

(All [a] (-> (lux;List (Chan a)) (Chan a)))

(no-dups eq xs)

Multiple consecutive equal values in the input channel will just be single value in the output channel.

(All [a] (-> (lux/control/eq;Eq a) (Chan a) (Chan a)))

(pipe input output)

Copy/pipe the contents of a channel on to another.

(All [a] (-> (Chan a) (Chan a) (lux/concurrency/promise;Promise lux;Unit)))

(write value chan)

Write to a channel, so long as it's still open.

(All [a] (-> a (Chan a) (lux/codata/io;IO (lux;Maybe (Chan a)))))