deferred-folds-0.9: Abstractions over deferred folds

Safe HaskellNone
LanguageHaskell2010

DeferredFolds.Unfoldr

Synopsis

Documentation

newtype Unfoldr a Source #

Constructors

Unfoldr (forall x. (a -> x -> x) -> x -> x) 
Instances
Monad Unfoldr # 
Instance details

Defined in DeferredFolds.Defs.Unfoldr

Methods

(>>=) :: Unfoldr a -> (a -> Unfoldr b) -> Unfoldr b #

(>>) :: Unfoldr a -> Unfoldr b -> Unfoldr b #

return :: a -> Unfoldr a #

fail :: String -> Unfoldr a #

Functor Unfoldr # 
Instance details

Defined in DeferredFolds.Defs.Unfoldr

Methods

fmap :: (a -> b) -> Unfoldr a -> Unfoldr b #

(<$) :: a -> Unfoldr b -> Unfoldr a #

Applicative Unfoldr # 
Instance details

Defined in DeferredFolds.Defs.Unfoldr

Methods

pure :: a -> Unfoldr a #

(<*>) :: Unfoldr (a -> b) -> Unfoldr a -> Unfoldr b #

liftA2 :: (a -> b -> c) -> Unfoldr a -> Unfoldr b -> Unfoldr c #

(*>) :: Unfoldr a -> Unfoldr b -> Unfoldr b #

(<*) :: Unfoldr a -> Unfoldr b -> Unfoldr a #

Foldable Unfoldr # 
Instance details

Defined in DeferredFolds.Defs.Unfoldr

Methods

fold :: Monoid m => Unfoldr m -> m #

foldMap :: Monoid m => (a -> m) -> Unfoldr a -> m #

foldr :: (a -> b -> b) -> b -> Unfoldr a -> b #

foldr' :: (a -> b -> b) -> b -> Unfoldr a -> b #

foldl :: (b -> a -> b) -> b -> Unfoldr a -> b #

foldl' :: (b -> a -> b) -> b -> Unfoldr a -> b #

foldr1 :: (a -> a -> a) -> Unfoldr a -> a #

foldl1 :: (a -> a -> a) -> Unfoldr a -> a #

toList :: Unfoldr a -> [a] #

null :: Unfoldr a -> Bool #

length :: Unfoldr a -> Int #

elem :: Eq a => a -> Unfoldr a -> Bool #

maximum :: Ord a => Unfoldr a -> a #

minimum :: Ord a => Unfoldr a -> a #

sum :: Num a => Unfoldr a -> a #

product :: Num a => Unfoldr a -> a #

Alternative Unfoldr # 
Instance details

Defined in DeferredFolds.Defs.Unfoldr

Methods

empty :: Unfoldr a #

(<|>) :: Unfoldr a -> Unfoldr a -> Unfoldr a #

some :: Unfoldr a -> Unfoldr [a] #

many :: Unfoldr a -> Unfoldr [a] #

MonadPlus Unfoldr # 
Instance details

Defined in DeferredFolds.Defs.Unfoldr

Methods

mzero :: Unfoldr a #

mplus :: Unfoldr a -> Unfoldr a -> Unfoldr a #

Eq a => Eq (Unfoldr a) # 
Instance details

Defined in DeferredFolds.Defs.Unfoldr

Methods

(==) :: Unfoldr a -> Unfoldr a -> Bool #

(/=) :: Unfoldr a -> Unfoldr a -> Bool #

Show a => Show (Unfoldr a) # 
Instance details

Defined in DeferredFolds.Defs.Unfoldr

Methods

showsPrec :: Int -> Unfoldr a -> ShowS #

show :: Unfoldr a -> String #

showList :: [Unfoldr a] -> ShowS #

Semigroup (Unfoldr a) # 
Instance details

Defined in DeferredFolds.Defs.Unfoldr

Methods

(<>) :: Unfoldr a -> Unfoldr a -> Unfoldr a #

sconcat :: NonEmpty (Unfoldr a) -> Unfoldr a #

stimes :: Integral b => b -> Unfoldr a -> Unfoldr a #

Monoid (Unfoldr a) # 
Instance details

Defined in DeferredFolds.Defs.Unfoldr

Methods

mempty :: Unfoldr a #

mappend :: Unfoldr a -> Unfoldr a -> Unfoldr a #

mconcat :: [Unfoldr a] -> Unfoldr a #

fold :: Fold input output -> Unfoldr input -> output Source #

Apply a Gonzalez fold

foldable :: Foldable foldable => foldable a -> Unfoldr a Source #

Construct from any foldable

filter :: (a -> Bool) -> Unfoldr a -> Unfoldr a Source #

Filter the values given a predicate

intsFrom :: Int -> Unfoldr Int Source #

Ascending infinite stream of ints starting from the one specified

intsInRange :: Int -> Int -> Unfoldr Int Source #

Ints in the specified inclusive range

mapAssocs :: Map key value -> Unfoldr (key, value) Source #

Associations of a map

intMapAssocs :: IntMap value -> Unfoldr (Int, value) Source #

Associations of an intmap

byteStringBytes :: ByteString -> Unfoldr Word8 Source #

Bytes of a bytestring

shortByteStringBytes :: ShortByteString -> Unfoldr Word8 Source #

Bytes of a short bytestring

primArray :: Prim prim => PrimArray prim -> Unfoldr prim Source #

Elements of a prim array

primArrayWithIndices :: Prim prim => PrimArray prim -> Unfoldr (Int, prim) Source #

Elements of a prim array coming paired with indices

decimalDigits :: Integral a => a -> Unfoldr a Source #

Extract individual digits of a non-negative integral number.

reverseDecimalDigits :: Integral a => a -> Unfoldr a Source #

Extract individual digits of a non-negative integral number in reverse order. More efficient than digits.

reverseDigits :: Integral a => a -> a -> Unfoldr a Source #

reverse :: Unfoldr a -> Unfoldr a Source #

Reverse the order

Use with care, because it requires to allocate all elements.

zipWithReverseIndex :: Unfoldr a -> Unfoldr (Int, a) Source #

Lift into an unfold, which produces pairs with right-associative index.