on develop help sign in
Allow a few more things to be inlined
commit68e1c18ffc710466800494841c2a3c1b95946fbf authorRyan Trinkle <ryan.trinkle@gmail.com> dateThu 6 Oct 2016, 12:26 (10 years ago) parentbd851a9
1 file changed+5−3
src/Reflex/Spider/Internal.hs+5−3
src/Reflex/Spider/Internal.hs+5−3
@@ -188,6 +188,7 @@ newtype Event x a = Event { subscribeAndRead :: Subscriber x a -> EventM x (Even
188188-- | Construct an 'Event' equivalent to that constructed by 'push', but with no
189189-- caching; if the computation function is very cheap, this is (much) more
190190-- efficient than 'push'
191+{-# INLINABLE pushCheap #-}
191192pushCheap :: (a -> ComputeM x (Maybe b)) -> Event x a -> Event x b
192193pushCheap f e = Event $ \sub -> do
193194 (subscription, occ) <- subscribeAndRead e $ sub
@@ -212,6 +213,7 @@ data CacheSubscribed x a
212213--TODO: Try a caching strategy where we subscribe directly to the parent when
213214--there's only one subscriber, and then build our own WeakBag only when a second
214215--subscriber joins
216+{-# INLINABLE cacheEvent #-}
215217cacheEvent :: Event x a -> Event x a
216218cacheEvent e = Event $ \sub -> do
217219 let !mSubscribedRef = unsafeNewIORef e Nothing
@@ -1138,7 +1140,7 @@ instance Functor (Event x) where
11381140instance Functor (Behavior x) where
11391141 fmap f = pull . fmap f . readBehaviorTracked
11401142
1141−{-# NOINLINE push #-} --TODO: If this is helpful, we can get rid of the unsafeNewIORef and use unsafePerformIO directly
1143+{-# INLINABLE push #-} --TODO: If this is helpful, we can get rid of the unsafeNewIORef and use unsafePerformIO directly
11421144push :: (a -> ComputeM x (Maybe b)) -> Event x a -> Event x b
11431145push f e = cacheEvent (pushCheap f e)
11441146{-
@@ -1150,7 +1152,7 @@ push f e = eventPush $ Push
11501152-- DISABLED: {- RULES "push/push" forall f g e. push f (push g e) = push (maybe (return Nothing) f <=< g) e #-}
11511153-}
11521154
1153−{-# NOINLINE pull #-}
1155+{-# INLINABLE pull #-}
11541156pull :: BehaviorM x a -> Behavior x a
11551157pull a = behaviorPull $ Pull
11561158 { pullCompute = a
@@ -1160,7 +1162,7 @@ pull a = behaviorPull $ Pull
11601162#endif
11611163 }
11621164
1163−{-# NOINLINE switch #-}
1165+{-# INLINABLE switch #-}
11641166switch :: Behavior x (Event x a) -> Event x a
11651167switch a = eventSwitch $ Switch
11661168 { switchParent = a