deferred-folds-0.6: Abstractions over deferred folds

Safe HaskellNone
LanguageHaskell2010

DeferredFolds.UnfoldM

Synopsis

Documentation

newtype UnfoldM m input Source #

A monadic variation of DeferredFolds.Unfold

Constructors

UnfoldM (forall output. (output -> input -> m output) -> output -> m output) 
Instances
Monad m => Monad (UnfoldM m) Source # 
Instance details

Defined in DeferredFolds.UnfoldM

Methods

(>>=) :: UnfoldM m a -> (a -> UnfoldM m b) -> UnfoldM m b #

(>>) :: UnfoldM m a -> UnfoldM m b -> UnfoldM m b #

return :: a -> UnfoldM m a #

fail :: String -> UnfoldM m a #

Functor m => Functor (UnfoldM m) Source # 
Instance details

Defined in DeferredFolds.UnfoldM

Methods

fmap :: (a -> b) -> UnfoldM m a -> UnfoldM m b #

(<$) :: a -> UnfoldM m b -> UnfoldM m a #

Monad m => Applicative (UnfoldM m) Source # 
Instance details

Defined in DeferredFolds.UnfoldM

Methods

pure :: a -> UnfoldM m a #

(<*>) :: UnfoldM m (a -> b) -> UnfoldM m a -> UnfoldM m b #

liftA2 :: (a -> b -> c) -> UnfoldM m a -> UnfoldM m b -> UnfoldM m c #

(*>) :: UnfoldM m a -> UnfoldM m b -> UnfoldM m b #

(<*) :: UnfoldM m a -> UnfoldM m b -> UnfoldM m a #

Foldable (UnfoldM Identity) Source # 
Instance details

Defined in DeferredFolds.UnfoldM

Methods

fold :: Monoid m => UnfoldM Identity m -> m #

foldMap :: Monoid m => (a -> m) -> UnfoldM Identity a -> m #

foldr :: (a -> b -> b) -> b -> UnfoldM Identity a -> b #

foldr' :: (a -> b -> b) -> b -> UnfoldM Identity a -> b #

foldl :: (b -> a -> b) -> b -> UnfoldM Identity a -> b #

foldl' :: (b -> a -> b) -> b -> UnfoldM Identity a -> b #

foldr1 :: (a -> a -> a) -> UnfoldM Identity a -> a #

foldl1 :: (a -> a -> a) -> UnfoldM Identity a -> a #

toList :: UnfoldM Identity a -> [a] #

null :: UnfoldM Identity a -> Bool #

length :: UnfoldM Identity a -> Int #

elem :: Eq a => a -> UnfoldM Identity a -> Bool #

maximum :: Ord a => UnfoldM Identity a -> a #

minimum :: Ord a => UnfoldM Identity a -> a #

sum :: Num a => UnfoldM Identity a -> a #

product :: Num a => UnfoldM Identity a -> a #

Monad m => Alternative (UnfoldM m) Source # 
Instance details

Defined in DeferredFolds.UnfoldM

Methods

empty :: UnfoldM m a #

(<|>) :: UnfoldM m a -> UnfoldM m a -> UnfoldM m a #

some :: UnfoldM m a -> UnfoldM m [a] #

many :: UnfoldM m a -> UnfoldM m [a] #

Monad m => MonadPlus (UnfoldM m) Source # 
Instance details

Defined in DeferredFolds.UnfoldM

Methods

mzero :: UnfoldM m a #

mplus :: UnfoldM m a -> UnfoldM m a -> UnfoldM m a #

Monad m => Semigroup (UnfoldM m a) Source # 
Instance details

Defined in DeferredFolds.UnfoldM

Methods

(<>) :: UnfoldM m a -> UnfoldM m a -> UnfoldM m a #

sconcat :: NonEmpty (UnfoldM m a) -> UnfoldM m a #

stimes :: Integral b => b -> UnfoldM m a -> UnfoldM m a #

Monad m => Monoid (UnfoldM m a) Source # 
Instance details

Defined in DeferredFolds.UnfoldM

Methods

mempty :: UnfoldM m a #

mappend :: UnfoldM m a -> UnfoldM m a -> UnfoldM m a #

mconcat :: [UnfoldM m a] -> UnfoldM m a #

foldlM' :: Monad m => (output -> input -> m output) -> output -> UnfoldM m input -> m output Source #

Perform a monadic strict left fold

mapM_ :: Monad m => (input -> m ()) -> UnfoldM m input -> m () Source #

forM_ :: Monad m => UnfoldM m input -> (input -> m ()) -> m () Source #

fold :: Fold input output -> UnfoldM Identity input -> output Source #

Apply a Gonzalez fold

foldM :: Monad m => FoldM m input output -> UnfoldM m input -> m output Source #

Apply a monadic Gonzalez fold

foldable :: (Monad m, Foldable foldable) => foldable a -> UnfoldM m a Source #

Construct from any foldable

intsInRange :: Monad m => Int -> Int -> UnfoldM m Int Source #

Ints in the specified inclusive range