Module

Control.XStream

Package
purescript-xstream
Repository
justinwoo/purescript-xstream

#STREAM Source

data STREAM :: Effect

#Subscription Source

#EffS Source

type EffS e a = Eff (stream :: STREAM | e) a

#Listener Source

type Listener e a = { next :: a -> Eff e Unit, error :: Error -> Eff e Unit, complete :: Unit -> Eff e Unit }

#EffListener Source

type EffListener e a = { next :: EffFn1 e a Unit, error :: EffFn1 e Error Unit, complete :: EffFn1 e Unit Unit }

#Producer Source

type Producer e a = { start :: Listener e a -> Eff e Unit, stop :: Unit -> Eff e Unit }

#EffProducer Source

type EffProducer e a = { start :: EffFn1 e (EffListener e a) Unit, stop :: EffFn1 e Unit Unit }

#defaultListener Source

defaultListener :: forall e a. Listener (console :: CONSOLE | e) a

#addListener Source

addListener :: forall e a. Listener e a -> Stream a -> Eff e Unit

#subscribe Source

subscribe :: forall e a. Listener e a -> Stream a -> Eff e Subscription

To cancel a subscription use cancelSubscription.

#cancelSubscription Source

#bindEff Source

bindEff :: forall e a b. Stream a -> (a -> Eff e (Stream b)) -> Eff e (Stream b)

Like bind/>>=, but for effects.

#delay Source

delay :: forall e a. Int -> Stream a -> Eff (timer :: TIMER | e) (Stream a)

#drop Source

drop :: forall a. Int -> Stream a -> Stream a

#endWhen Source

endWhen :: forall a b. Stream b -> Stream a -> Stream b

#filter Source

filter :: forall a. (a -> Boolean) -> Stream a -> Stream a

#fold Source

fold :: forall a b. (b -> a -> b) -> b -> Stream a -> Stream b

#imitate Source

imitate :: forall e a. Stream a -> Stream a -> Eff e (Either Error Unit)

#last Source

last :: forall a. Stream a -> Stream a

#mapTo Source

mapTo :: forall a b. b -> Stream a -> Stream b

#startWith Source

startWith :: forall a. a -> Stream a -> Stream a

#switchMap Source

switchMap :: forall a b. Stream a -> (a -> Stream b) -> Stream b

Like bind/>>=, but switches to the latest emitted source using flatten.

#switchMapEff Source

switchMapEff :: forall e a b. Stream a -> (a -> Eff e (Stream b)) -> Eff e (Stream b)

Like bindEff, but switches to the lattest emitted source using flatten.

#replaceError Source

replaceError :: forall a. (Error -> Stream a) -> Stream a -> Stream a

#take Source

take :: forall a. Int -> Stream a -> Stream a

#shamefullySendNext Source

shamefullySendNext :: forall e a. a -> Stream a -> Eff e Unit

Hacky 'hidden' method for sending next to a Stream like with Subjects. This may only work with streams created with create'.

#shamefullySendError Source

shamefullySendError :: forall e a. Error -> Stream a -> Eff e Unit

#shamefullySendComplete Source

shamefullySendComplete :: forall e a. Unit -> Stream a -> Eff e Unit

#create Source

create :: forall e a. Producer e a -> Eff e (Stream a)

#create' Source

create' :: forall e a. Eff e (Stream a)

#createWithMemory Source

createWithMemory :: forall e a. Producer e a -> Eff e (Stream a)

#fromCallback Source

fromCallback :: forall e a b. ((a -> Eff e Unit) -> Eff e b) -> Eff e (Stream a)

create a Stream from a callback

#periodic Source

periodic :: forall e. Int -> Eff (timer :: TIMER | e) (Stream Int)

#flattenEff Source

flattenEff :: forall e a. Stream (Eff e (Stream a)) -> Eff e (Stream a)

#flatten Source

flatten :: forall a. Stream (Stream a) -> Stream a

#fromArray Source

fromArray :: forall a. Array a -> Stream a

#never Source

never :: forall a. Stream a

#remember Source

remember :: forall a. Stream a -> Stream a

#throw Source

throw :: forall a. Error -> Stream a

#adaptListener Source

adaptListener :: forall e a. Listener e a -> EffListener e a