G64LUZSXYNCYM6OBDLBOCQODNVOF7EM4DUA2IFP43FR46RA5VR3AC
runSteps :: StepFun s a -> s -> [a]
runSteps (StepFun sf) = go
data Stream a = forall s. Stream
(StepFun s a) -- ^ stepper function
!s -- ^ current state
instance Functor Stream where
fmap f (Stream step_ cst) = Stream (fmap f step_) cst
unstream :: Stream a -> [a]
unstream (Stream (StepFun sf) ctx) = go ctx
instance Functor Stream where
fmap f (Stream step_ cst) = Stream (fmap f step_) cst
runStream :: Stream a -> [a]
runStream (Stream sf ctx) = runSteps sf ctx
{-# INLINE runStream #-}
{-# RULES
"gardground stream/unstream" forall (s :: Stream a). stream (unstream s) = s
#-}