on develop help sign in
Merge pull request #202 from reflex-frp/doc-typos
e52ce57Ryan Trinkle
src/Reflex/Class.hs+11−11
@@ -219,7 +219,7 @@ class ( MonadHold t (PushM t)
219 -- recomputed whenever any of the read 'Behavior's changes
219 -- recomputed whenever any of the read 'Behavior's changes
220 pull :: PullM t a -> Behavior t a
220 pull :: PullM t a -> Behavior t a
221 -- | Merge a collection of events; the resulting 'Event' will only occur if at
221 -- | Merge a collection of events; the resulting 'Event' will only occur if at
222− -- least one input event is occuring, and will contain all of the input keys
222+ -- least one input event is occurring, and will contain all of the input keys
223 -- that are occurring simultaneously
223 -- that are occurring simultaneously
224 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
224 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
225 -- | Efficiently fan-out an event to many destinations. This function should
225 -- | Efficiently fan-out an event to many destinations. This function should
@@ -330,7 +330,7 @@ class MonadSample t m => MonadHold t m where
330 default buildDynamic :: (m ~ f m', MonadTrans f, MonadHold t m') => PullM t a -> Event t a -> m (Dynamic t a)
330 default buildDynamic :: (m ~ f m', MonadTrans f, MonadHold t m') => PullM t a -> Event t a -> m (Dynamic t a)
331 buildDynamic getV0 = lift . buildDynamic getV0
331 buildDynamic getV0 = lift . buildDynamic getV0
332 -}
332 -}
333− -- | Create a new 'Event' that only occurs only once, on the first occurence of
333+ -- | Create a new 'Event' that only occurs only once, on the first occurrence of
334 -- the supplied 'Event'.
334 -- the supplied 'Event'.
335 headE :: Event t a -> m (Event t a)
335 headE :: Event t a -> m (Event t a)
336
336
@@ -559,7 +559,7 @@ tailE e = snd <$> headTailE e
559
559
560-- | Create a tuple of two 'Event's with the first one occurring only the first
560-- | Create a tuple of two 'Event's with the first one occurring only the first
561-- time the supplied 'Event' occurs and the second occurring on all but the first
561-- time the supplied 'Event' occurs and the second occurring on all but the first
562−-- occurence.
562+-- occurrence.
563headTailE :: (Reflex t, MonadHold t m) => Event t a -> m (Event t a, Event t a)
563headTailE :: (Reflex t, MonadHold t m) => Event t a -> m (Event t a, Event t a)
564headTailE e = do
564headTailE e = do
565 eHead <- headE e
565 eHead <- headE e
@@ -579,13 +579,13 @@ takeWhileE f e = do
579 let e' = switch be
579 let e' = switch be
580 return eTrue
580 return eTrue
581
581
582−-- | Split the supplied 'Event' into two individual 'Event's occuring at the
582+-- | Split the supplied 'Event' into two individual 'Event's occurring at the
583-- same time with the respective values from the tuple.
583-- same time with the respective values from the tuple.
584splitE :: Reflex t => Event t (a, b) -> (Event t a, Event t b)
584splitE :: Reflex t => Event t (a, b) -> (Event t a, Event t b)
585splitE e = (fmap fst e, fmap snd e)
585splitE e = (fmap fst e, fmap snd e)
586
586
587-- | Print the supplied 'String' and the value of the 'Event' on each
587-- | Print the supplied 'String' and the value of the 'Event' on each
588−-- occurence. This should /only/ be used for debugging.
588+-- occurrence. This should /only/ be used for debugging.
589--
589--
590-- Note: As with Debug.Trace.trace, the message will only be printed if the
590-- Note: As with Debug.Trace.trace, the message will only be printed if the
591-- 'Event' is actually used.
591-- 'Event' is actually used.
@@ -647,7 +647,7 @@ unsafeMapIncremental f g a = unsafeBuildIncremental (fmap f $ sample $ currentIn
647
647
648-- | Create a new 'Event' combining the map of 'Event's into an 'Event' that
648-- | Create a new 'Event' combining the map of 'Event's into an 'Event' that
649-- occurs if at least one of them occurs and has a map of values of all 'Event's
649-- occurs if at least one of them occurs and has a map of values of all 'Event's
650−-- occuring at that time.
650+-- occurring at that time.
651mergeMap :: (Reflex t, Ord k) => Map k (Event t a) -> Event t (Map k a)
651mergeMap :: (Reflex t, Ord k) => Map k (Event t a) -> Event t (Map k a)
652mergeMap = fmap dmapToMap . merge . mapWithFunctorToDMap
652mergeMap = fmap dmapToMap . merge . mapWithFunctorToDMap
653
653
@@ -734,7 +734,7 @@ instance Reflex t => Align (Event t) where
734 align = alignEventWithMaybe Just
734 align = alignEventWithMaybe Just
735
735
736-- | Create a new 'Event' that only occurs if the supplied 'Event' occurs and
736-- | Create a new 'Event' that only occurs if the supplied 'Event' occurs and
737−-- the 'Behavior' is true at the time of occurence.
737+-- the 'Behavior' is true at the time of occurrence.
738gate :: Reflex t => Behavior t Bool -> Event t a -> Event t a
738gate :: Reflex t => Behavior t Bool -> Event t a -> Event t a
739gate = attachWithMaybe $ \allow a -> if allow then Just a else Nothing
739gate = attachWithMaybe $ \allow a -> if allow then Just a else Nothing
740
740
@@ -962,7 +962,7 @@ instance Reflex t => Accumulator t (Event t) where
962 accumMaybeM f z e = updated <$> accumMaybeM f z e
962 accumMaybeM f z e = updated <$> accumMaybeM f z e
963 mapAccumMaybeM f z e = first updated <$> mapAccumMaybeM f z e
963 mapAccumMaybeM f z e = first updated <$> mapAccumMaybeM f z e
964
964
965−-- | Create a new 'Event' by combining each occurence with the next value of the
965+-- | Create a new 'Event' by combining each occurrence with the next value of the
966-- list using the supplied function. If the list runs out of items, all
966-- list using the supplied function. If the list runs out of items, all
967-- subsequent 'Event' occurrences will be ignored.
967-- subsequent 'Event' occurrences will be ignored.
968zipListWithEvent :: (Reflex t, MonadHold t m, MonadFix m) => (a -> b -> c) -> [a] -> Event t b -> m (Event t c)
968zipListWithEvent :: (Reflex t, MonadHold t m, MonadFix m) => (a -> b -> c) -> [a] -> Event t b -> m (Event t c)
@@ -972,17 +972,17 @@ zipListWithEvent f l e = do
972 _ -> (Nothing, Nothing) --TODO: Unsubscribe the event?
972 _ -> (Nothing, Nothing) --TODO: Unsubscribe the event?
973 mapAccumMaybe_ f' l e
973 mapAccumMaybe_ f' l e
974
974
975−-- | Assign a number to each occurence of the given 'Event', starting from 0
975+-- | Assign a number to each occurrence of the given 'Event', starting from 0
976{-# INLINE numberOccurrences #-}
976{-# INLINE numberOccurrences #-}
977numberOccurrences :: (Reflex t, MonadHold t m, MonadFix m, Num b) => Event t a -> m (Event t (b, a))
977numberOccurrences :: (Reflex t, MonadHold t m, MonadFix m, Num b) => Event t a -> m (Event t (b, a))
978numberOccurrences = numberOccurrencesFrom 0
978numberOccurrences = numberOccurrencesFrom 0
979
979
980−-- | Assign a number to each occurence of the given 'Event'
980+-- | Assign a number to each occurrence of the given 'Event'
981{-# INLINE numberOccurrencesFrom #-}
981{-# INLINE numberOccurrencesFrom #-}
982numberOccurrencesFrom :: (Reflex t, MonadHold t m, MonadFix m, Num b) => b -> Event t a -> m (Event t (b, a))
982numberOccurrencesFrom :: (Reflex t, MonadHold t m, MonadFix m, Num b) => b -> Event t a -> m (Event t (b, a))
983numberOccurrencesFrom = mapAccum_ (\n a -> let !next = n + 1 in (next, (n, a)))
983numberOccurrencesFrom = mapAccum_ (\n a -> let !next = n + 1 in (next, (n, a)))
984
984
985−-- | Assign a number to each occurence of the given 'Event'; discard the occurrences' values
985+-- | Assign a number to each occurrence of the given 'Event'; discard the occurrences' values
986{-# INLINE numberOccurrencesFrom_ #-}
986{-# INLINE numberOccurrencesFrom_ #-}
987numberOccurrencesFrom_ :: (Reflex t, MonadHold t m, MonadFix m, Num b) => b -> Event t a -> m (Event t b)
987numberOccurrencesFrom_ :: (Reflex t, MonadHold t m, MonadFix m, Num b) => b -> Event t a -> m (Event t b)
988numberOccurrencesFrom_ = mapAccum_ (\n _ -> let !next = n + 1 in (next, n))
988numberOccurrencesFrom_ = mapAccum_ (\n _ -> let !next = n + 1 in (next, n))
src/Reflex/Dynamic.hs+2−2
@@ -173,7 +173,7 @@ foldDynMaybe = accumMaybeDyn . flip
173foldDynMaybeM :: (Reflex t, MonadHold t m, MonadFix m) => (a -> b -> PushM t (Maybe b)) -> b -> Event t a -> m (Dynamic t b)
173foldDynMaybeM :: (Reflex t, MonadHold t m, MonadFix m) => (a -> b -> PushM t (Maybe b)) -> b -> Event t a -> m (Dynamic t b)
174foldDynMaybeM = accumMaybeMDyn . flip
174foldDynMaybeM = accumMaybeMDyn . flip
175
175
176−-- | Create a new 'Dynamic' that counts the occurences of the 'Event'.
176+-- | Create a new 'Dynamic' that counts the occurrences of the 'Event'.
177count :: (Reflex t, MonadHold t m, MonadFix m, Num b) => Event t a -> m (Dynamic t b)
177count :: (Reflex t, MonadHold t m, MonadFix m, Num b) => Event t a -> m (Dynamic t b)
178count e = holdDyn 0 =<< zipListWithEvent const (iterate (+1) 1) e
178count e = holdDyn 0 =<< zipListWithEvent const (iterate (+1) 1) e
179
179
@@ -287,7 +287,7 @@ attachPromptlyDyn = attachPromptlyDynWith (,)
287attachPromptlyDynWith :: Reflex t => (a -> b -> c) -> Dynamic t a -> Event t b -> Event t c
287attachPromptlyDynWith :: Reflex t => (a -> b -> c) -> Dynamic t a -> Event t b -> Event t c
288attachPromptlyDynWith f = attachPromptlyDynWithMaybe $ \a b -> Just $ f a b
288attachPromptlyDynWith f = attachPromptlyDynWithMaybe $ \a b -> Just $ f a b
289
289
290−-- | Create a new 'Event' by combining the value at each occurence with the
290+-- | Create a new 'Event' by combining the value at each occurrence with the
291-- current value of the 'Dynamic' value and possibly filtering if the combining
291-- current value of the 'Dynamic' value and possibly filtering if the combining
292-- function returns 'Nothing'.
292-- function returns 'Nothing'.
293--
293--
src/Reflex/Time.hs+2−2
@@ -107,7 +107,7 @@ delay dt e = performEventAsync $ ffor e $ \a cb -> liftIO $ void $ forkIO $ do
107 cb a
107 cb a
108
108
109-- | Send events with Poisson timing with the given basis and rate
109-- | Send events with Poisson timing with the given basis and rate
110−-- Each occurence of the resulting event will contain the index of
110+-- Each occurrence of the resulting event will contain the index of
111-- the current interval, with 0 representing the basis time
111-- the current interval, with 0 representing the basis time
112poissonLossyFrom
112poissonLossyFrom
113 :: (RandomGen g, MonadIO (Performable m), PerformEvent t m, TriggerEvent t m)
113 :: (RandomGen g, MonadIO (Performable m), PerformEvent t m, TriggerEvent t m)
@@ -126,7 +126,7 @@ poissonLossyFrom rnd rate = inhomogeneousPoissonFrom rnd (constant rate) rate
126
126
127
127
128-- | Send events with Poisson timing with the given basis and rate
128-- | Send events with Poisson timing with the given basis and rate
129−-- Each occurence of the resulting event will contain the index of
129+-- Each occurrence of the resulting event will contain the index of
130-- the current interval, with 0 representing the basis time.
130-- the current interval, with 0 representing the basis time.
131-- Automatically begin sending events when the DOM is built
131-- Automatically begin sending events when the DOM is built
132poissonLossy
132poissonLossy
test/Reflex/Plan/Reflex.hs+2−2
@@ -74,13 +74,13 @@ deriving instance ReflexHost t => MonadFix (Plan t)
74
74
75
75
76instance (ReflexHost t, MonadRef (HostFrame t), Ref (HostFrame t) ~ Ref IO) => TestPlan t (Plan t) where
76instance (ReflexHost t, MonadRef (HostFrame t), Ref (HostFrame t) ~ Ref IO) => TestPlan t (Plan t) where
77− plan occurances = Plan $ do
77+ plan occurrences = Plan $ do
78 (e, ref) <- newEventWithTriggerRef
78 (e, ref) <- newEventWithTriggerRef
79 modify (IntMap.unionWith mappend (firings ref))
79 modify (IntMap.unionWith mappend (firings ref))
80 return e
80 return e
81
81
82 where
82 where
83− firings ref = IntMap.fromList (makeFiring ref <$> occurances)
83+ firings ref = IntMap.fromList (makeFiring ref <$> occurrences)
84 makeFiring ref (t, a) = (fromIntegral t, [Firing ref a])
84 makeFiring ref (t, a) = (fromIntegral t, [Firing ref a])
85
85
86
86