@@ -1,3 +1,4 @@
1+{-# LANGUAGE BangPatterns #-}
1{-# LANGUAGE ConstraintKinds #-}
2{-# LANGUAGE ConstraintKinds #-}
2{-# LANGUAGE CPP #-}
3{-# LANGUAGE CPP #-}
3{-# LANGUAGE DefaultSignatures #-}
4{-# LANGUAGE DefaultSignatures #-}
@@ -1113,12 +1114,12 @@ numberOccurrences = numberOccurrencesFrom 0
1113-- | Assign a number to each occurence of the given 'Event'
1114-- | Assign a number to each occurence of the given 'Event'
1114{-# INLINE numberOccurrencesFrom #-}
1115{-# INLINE numberOccurrencesFrom #-}
1115numberOccurrencesFrom :: (Reflex t, MonadHold t m, MonadFix m, Num b) => b -> Event t a -> m (Event t (b, a))
1116numberOccurrencesFrom :: (Reflex t, MonadHold t m, MonadFix m, Num b) => b -> Event t a -> m (Event t (b, a))
1116−numberOccurrencesFrom = mapAccum_ (\n a -> (n + 1, (n, a)))
1117+numberOccurrencesFrom = mapAccum_ (\n a -> let !next = n + 1 in (next, (n, a)))
1118-- | Assign a number to each occurence of the given 'Event'; discard the occurrences' values
1119-- | Assign a number to each occurence of the given 'Event'; discard the occurrences' values
1119{-# INLINE numberOccurrencesFrom_ #-}
1120{-# INLINE numberOccurrencesFrom_ #-}
1120numberOccurrencesFrom_ :: (Reflex t, MonadHold t m, MonadFix m, Num b) => b -> Event t a -> m (Event t b)
1121numberOccurrencesFrom_ :: (Reflex t, MonadHold t m, MonadFix m, Num b) => b -> Event t a -> m (Event t b)
1121−numberOccurrencesFrom_ = mapAccum_ (\n _ -> (n + 1, n))
1122+numberOccurrencesFrom_ = mapAccum_ (\n _ -> let !next = n + 1 in (next, n))
1123-- | This is used to sample the value of a 'Behavior' using an 'Event'.
1124-- | This is used to sample the value of a 'Behavior' using an 'Event'.