Module
FRP.Event.Class
- Package
- purescript-behaviors
- Repository
- paf31/purescript-behaviors
#IsEvent Source
class (Alternative event, Filterable event) <= IsEvent event where
Functions which an Event
type should implement, so that
Behavior
s can be defined in terms of any such event type:
fold
: combines incoming values using the specified function, starting with the specific initial value.keepLatest
flattens 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 b
keepLatest :: forall a. event (event a) -> event a
sampleOn :: forall b a. event a -> event (a -> b) -> event b
fix :: forall o i. (event i -> { input :: event i, output :: event o }) -> event o
Re-exports from Data.Filterable
#Filterable Source
class (Functor f) <= Filterable f where
Filterable
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:
map f ≡ filterMap (Just <<< f)
filter ≡ filterMap <<< maybeBool
filterMap p ≡ filter (isJust <<< p)
Default implementations are provided by the following functions:
partitionDefault
partitionDefaultFilter
partitionDefaultFilterMap
filterDefault
filterDefaultPartition
filterDefaultPartitionMap
Members
Instances
Filterable Array
Filterable Maybe
(Monoid m) => Filterable (Either m)
Filterable List
(Ord k) => Filterable (Map k)