@@ -226,7 +226,7 @@ class ( MonadHold t (PushM t)
226 -- recomputed whenever any of the read 'Behavior's changes
226 -- recomputed whenever any of the read 'Behavior's changes
227 pull :: PullM t a -> Behavior t a
227 pull :: PullM t a -> Behavior t a
228 -- | Merge a collection of events; the resulting 'Event' will only occur if at
228 -- | Merge a collection of events; the resulting 'Event' will only occur if at
229− -- least one input event is occuring, and will contain all of the input keys
229+ -- least one input event is occurring, and will contain all of the input keys
230 -- that are occurring simultaneously
230 -- that are occurring simultaneously
231 merge :: GCompare k => DMap k (Event t) -> Event t (DMap k Identity) --TODO: Generalize to get rid of DMap use --TODO: Provide a type-level guarantee that the result is not empty
231 merge :: GCompare k => DMap k (Event t) -> Event t (DMap k Identity) --TODO: Generalize to get rid of DMap use --TODO: Provide a type-level guarantee that the result is not empty
232 -- | Efficiently fan-out an event to many destinations. This function should
232 -- | Efficiently fan-out an event to many destinations. This function should
@@ -337,7 +337,7 @@ class MonadSample t m => MonadHold t m where
337 default buildDynamic :: (m ~ f m', MonadTrans f, MonadHold t m') => PullM t a -> Event t a -> m (Dynamic t a)
337 default buildDynamic :: (m ~ f m', MonadTrans f, MonadHold t m') => PullM t a -> Event t a -> m (Dynamic t a)
338 buildDynamic getV0 = lift . buildDynamic getV0
338 buildDynamic getV0 = lift . buildDynamic getV0
340− -- | Create a new 'Event' that only occurs only once, on the first occurence of
340+ -- | Create a new 'Event' that only occurs only once, on the first occurrence of
341 -- the supplied 'Event'.
341 -- the supplied 'Event'.
342 headE :: Event t a -> m (Event t a)
342 headE :: Event t a -> m (Event t a)
@@ -566,7 +566,7 @@ tailE e = snd <$> headTailE e
567-- | Create a tuple of two 'Event's with the first one occurring only the first
567-- | Create a tuple of two 'Event's with the first one occurring only the first
568-- time the supplied 'Event' occurs and the second occurring on all but the first
568-- time the supplied 'Event' occurs and the second occurring on all but the first
569−-- occurence.
569+-- occurrence.
570headTailE :: (Reflex t, MonadHold t m) => Event t a -> m (Event t a, Event t a)
570headTailE :: (Reflex t, MonadHold t m) => Event t a -> m (Event t a, Event t a)
571headTailE e = do
571headTailE e = do
572 eHead <- headE e
572 eHead <- headE e
@@ -586,13 +586,13 @@ takeWhileE f e = do
586 let e' = switch be
586 let e' = switch be
587 return eTrue
587 return eTrue
589−-- | Split the supplied 'Event' into two individual 'Event's occuring at the
589+-- | Split the supplied 'Event' into two individual 'Event's occurring at the
590-- same time with the respective values from the tuple.
590-- same time with the respective values from the tuple.
591splitE :: Reflex t => Event t (a, b) -> (Event t a, Event t b)
591splitE :: Reflex t => Event t (a, b) -> (Event t a, Event t b)
592splitE e = (fmap fst e, fmap snd e)
592splitE e = (fmap fst e, fmap snd e)
594-- | Print the supplied 'String' and the value of the 'Event' on each
594-- | Print the supplied 'String' and the value of the 'Event' on each
595−-- occurence. This should /only/ be used for debugging.
595+-- occurrence. This should /only/ be used for debugging.
597-- Note: As with Debug.Trace.trace, the message will only be printed if the
597-- Note: As with Debug.Trace.trace, the message will only be printed if the
598-- 'Event' is actually used.
598-- 'Event' is actually used.
@@ -654,7 +654,7 @@ unsafeMapIncremental f g a = unsafeBuildIncremental (fmap f $ sample $ currentIn
655-- | Create a new 'Event' combining the map of 'Event's into an 'Event' that
655-- | Create a new 'Event' combining the map of 'Event's into an 'Event' that
656-- occurs if at least one of them occurs and has a map of values of all 'Event's
656-- occurs if at least one of them occurs and has a map of values of all 'Event's
657−-- occuring at that time.
657+-- occurring at that time.
658mergeMap :: (Reflex t, Ord k) => Map k (Event t a) -> Event t (Map k a)
658mergeMap :: (Reflex t, Ord k) => Map k (Event t a) -> Event t (Map k a)
659mergeMap = fmap dmapToMap . merge . mapWithFunctorToDMap
659mergeMap = fmap dmapToMap . merge . mapWithFunctorToDMap
@@ -741,7 +741,7 @@ instance Reflex t => Align (Event t) where
741 align = alignEventWithMaybe Just
741 align = alignEventWithMaybe Just
743-- | Create a new 'Event' that only occurs if the supplied 'Event' occurs and
743-- | Create a new 'Event' that only occurs if the supplied 'Event' occurs and
744−-- the 'Behavior' is true at the time of occurence.
744+-- the 'Behavior' is true at the time of occurrence.
745gate :: Reflex t => Behavior t Bool -> Event t a -> Event t a
745gate :: Reflex t => Behavior t Bool -> Event t a -> Event t a
746gate = attachWithMaybe $ \allow a -> if allow then Just a else Nothing
746gate = attachWithMaybe $ \allow a -> if allow then Just a else Nothing
@@ -969,7 +969,7 @@ instance Reflex t => Accumulator t (Event t) where
969 accumMaybeM f z e = updated <$> accumMaybeM f z e
969 accumMaybeM f z e = updated <$> accumMaybeM f z e
970 mapAccumMaybeM f z e = first updated <$> mapAccumMaybeM f z e
970 mapAccumMaybeM f z e = first updated <$> mapAccumMaybeM f z e
972−-- | Create a new 'Event' by combining each occurence with the next value of the
972+-- | Create a new 'Event' by combining each occurrence with the next value of the
973-- list using the supplied function. If the list runs out of items, all
973-- list using the supplied function. If the list runs out of items, all
974-- subsequent 'Event' occurrences will be ignored.
974-- subsequent 'Event' occurrences will be ignored.
975zipListWithEvent :: (Reflex t, MonadHold t m, MonadFix m) => (a -> b -> c) -> [a] -> Event t b -> m (Event t c)
975zipListWithEvent :: (Reflex t, MonadHold t m, MonadFix m) => (a -> b -> c) -> [a] -> Event t b -> m (Event t c)
@@ -979,17 +979,17 @@ zipListWithEvent f l e = do
979 _ -> (Nothing, Nothing) --TODO: Unsubscribe the event?
979 _ -> (Nothing, Nothing) --TODO: Unsubscribe the event?
980 mapAccumMaybe_ f' l e
980 mapAccumMaybe_ f' l e
982−-- | Assign a number to each occurence of the given 'Event', starting from 0
982+-- | Assign a number to each occurrence of the given 'Event', starting from 0
983{-# INLINE numberOccurrences #-}
983{-# INLINE numberOccurrences #-}
984numberOccurrences :: (Reflex t, MonadHold t m, MonadFix m, Num b) => Event t a -> m (Event t (b, a))
984numberOccurrences :: (Reflex t, MonadHold t m, MonadFix m, Num b) => Event t a -> m (Event t (b, a))
985numberOccurrences = numberOccurrencesFrom 0
985numberOccurrences = numberOccurrencesFrom 0
987−-- | Assign a number to each occurence of the given 'Event'
987+-- | Assign a number to each occurrence of the given 'Event'
988{-# INLINE numberOccurrencesFrom #-}
988{-# INLINE numberOccurrencesFrom #-}
989numberOccurrencesFrom :: (Reflex t, MonadHold t m, MonadFix m, Num b) => b -> Event t a -> m (Event t (b, a))
989numberOccurrencesFrom :: (Reflex t, MonadHold t m, MonadFix m, Num b) => b -> Event t a -> m (Event t (b, a))
990numberOccurrencesFrom = mapAccum_ (\n a -> let !next = n + 1 in (next, (n, a)))
990numberOccurrencesFrom = mapAccum_ (\n a -> let !next = n + 1 in (next, (n, a)))
992−-- | Assign a number to each occurence of the given 'Event'; discard the occurrences' values
992+-- | Assign a number to each occurrence of the given 'Event'; discard the occurrences' values
993{-# INLINE numberOccurrencesFrom_ #-}
993{-# INLINE numberOccurrencesFrom_ #-}
994numberOccurrencesFrom_ :: (Reflex t, MonadHold t m, MonadFix m, Num b) => b -> Event t a -> m (Event t b)
994numberOccurrencesFrom_ :: (Reflex t, MonadHold t m, MonadFix m, Num b) => b -> Event t a -> m (Event t b)
995numberOccurrencesFrom_ = mapAccum_ (\n _ -> let !next = n + 1 in (next, n))
995numberOccurrencesFrom_ = mapAccum_ (\n _ -> let !next = n + 1 in (next, n))