module DeferredFolds.Defs.UnfoldrM where import DeferredFolds.Prelude import DeferredFolds.Types unfoldr :: Monad m => Unfoldr a -> UnfoldrM m a unfoldr :: Unfoldr a -> UnfoldrM m a unfoldr (Unfoldr forall x. (a -> x -> x) -> x -> x unfoldr) = (forall x. (a -> x -> m x) -> x -> m x) -> UnfoldrM m a forall (m :: * -> *) a. (forall x. (a -> x -> m x) -> x -> m x) -> UnfoldrM m a UnfoldrM ((forall x. (a -> x -> m x) -> x -> m x) -> UnfoldrM m a) -> (forall x. (a -> x -> m x) -> x -> m x) -> UnfoldrM m a forall a b. (a -> b) -> a -> b $ \ a -> x -> m x stepM -> let step :: a -> (x -> m x) -> x -> m x step a input x -> m x act x state = a -> x -> m x stepM a input x state m x -> (x -> m x) -> m x forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b >>= x -> m x act in (a -> (x -> m x) -> x -> m x) -> (x -> m x) -> x -> m x forall x. (a -> x -> x) -> x -> x unfoldr a -> (x -> m x) -> x -> m x step x -> m x forall (m :: * -> *) a. Monad m => a -> m a return