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 = { complete :: Unit -> Eff e Unit, error :: Error -> Eff e Unit, next :: a -> Eff e Unit }

#EffListener Source

type EffListener e a = { complete :: EffFn1 e Unit Unit, error :: EffFn1 e Error Unit, next :: EffFn1 e a 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 a e. Listener (console :: CONSOLE | e) a

#addListener Source

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

#subscribe Source

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

To cancel a subscription use cancelSubscription.

#cancelSubscription Source

#bindEff Source

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

Like bind/>>=, but for effects.

#delay Source

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

#drop Source

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

#endWhen Source

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

#filter Source

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

#fold Source

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

#imitate Source

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

#last Source

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

#mapTo Source

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

#startWith Source

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

#switchMap Source

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

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

#switchMapEff Source

switchMapEff :: forall b a e. 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 a e. 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 a e. Error -> Stream a -> Eff e Unit

#shamefullySendComplete Source

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

#create Source

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

#create' Source

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

#createWithMemory Source

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

#fromCallback Source

fromCallback :: forall b a e. ((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 a e. 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 a e. Listener e a -> EffListener e a