diff --git a/automaton/src/Data/Stream/Optimized.hs b/automaton/src/Data/Stream/Optimized.hs index ef30ff2c..e6a757d2 100644 --- a/automaton/src/Data/Stream/Optimized.hs +++ b/automaton/src/Data/Stream/Optimized.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE BangPatterns #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DerivingVia #-} {-# LANGUAGE RankNTypes #-} @@ -160,8 +161,8 @@ handleOptimized f stream = Stateful $ f $ toStreamT stream See 'Data.Stream.reactimate'. -} reactimate :: (Monad m) => OptimizedStreamT m () -> m void -reactimate (Stateful stream) = StreamT.reactimate stream -reactimate (Stateless f) = go +reactimate (Stateful !stream) = StreamT.reactimate stream +reactimate (Stateless !f) = go where go = f *> go {-# INLINE reactimate #-} @@ -173,7 +174,6 @@ since the optimized version doesn't create a state type. -} constM :: m a -> OptimizedStreamT m a constM = Stateless -{-# INLINE constM #-} -- | Perform one step of a stream, resulting in an updated stream and an output value. stepOptimizedStream :: (Functor m) => OptimizedStreamT m a -> m (Result (OptimizedStreamT m a) a) diff --git a/rhine/src/FRP/Rhine/Reactimation.hs b/rhine/src/FRP/Rhine/Reactimation.hs index 7f07ab3c..47a68bc5 100644 --- a/rhine/src/FRP/Rhine/Reactimation.hs +++ b/rhine/src/FRP/Rhine/Reactimation.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE BangPatterns #-} {-# LANGUAGE GADTs #-} {- | @@ -55,7 +56,7 @@ flow :: Rhine m cl () () -> m void flow rhine = do - automaton <- eraseClock rhine + !automaton <- eraseClock rhine reactimate $ automaton >>> arr (const ()) {-# INLINE flow #-}