FRP.Event.Class
- Package
- purescript-event
- Repository
- paf31/purescript-event
#IsEvent Source
class (Alternative event, Filterable event) <= IsEvent event whereFunctions which an Event type should implement:
fold: combines incoming values using the specified function, starting with the specific initial value.keepLatestflattens a nested event, reporting values only from the most recent inner event.sampleOn: samples an event at the times when a second event fires.fix: compute a fixed point, by feeding output events back in as inputs.
Members
fold :: forall b a. (a -> b -> b) -> event a -> b -> event bkeepLatest :: forall a. event (event a) -> event asampleOn :: forall b a. event a -> event (a -> b) -> event bfix :: forall o i. (event i -> { input :: event i, output :: event o }) -> event o
Re-exports from Data.Filterable
#Filterable Source
class (Compactable f, Functor f) <= Filterable f whereFilterable represents data structures which can be partitioned/filtered.
partitionMap- partition a data structure based on an either predicate.partition- partition a data structure based on boolean predicate.filterMap- map over a data structure and filter based on a maybe.filter- filter a data structure based on a boolean.
Laws:
Functor Relation:
filterMap identity ≡ compactFunctor Identity:
filterMap Just ≡ identityKleisli Composition:
filterMap (l <=< r) ≡ filterMap l <<< filterMap rfilter ≡ filterMap <<< maybeBoolfilterMap p ≡ filter (isJust <<< p)Functor Relation:
partitionMap identity ≡ separateFunctor Identity 1:
_.right <<< partitionMap Right ≡ identityFunctor Identity 2:
_.left <<< partitionMap Left ≡ identityf <<< partition ≡ partitionMap <<< eitherBoolwheref = \{ no, yes } -> { left: no, right: yes }f <<< partitionMap p ≡ partition (isRight <<< p)wheref = \{ left, right } -> { no: left, yes: right}
Default implementations are provided by the following functions:
partitionDefaultpartitionDefaultFilterpartitionDefaultFilterMappartitionMapDefaultfilterDefaultfilterDefaultPartitionfilterDefaultPartitionMapfilterMapDefault
Members
Instances
Filterable ArrayFilterable Maybe(Monoid m) => Filterable (Either m)Filterable List(Ord k) => Filterable (Map k)
- Modules
- FRP.
Event - FRP.
Event. Class - FRP.
Event. Time