deferred-folds-0.9.17: Abstractions over deferred folds
Safe HaskellNone
LanguageHaskell2010

DeferredFolds.Defs.Unfoldr

Synopsis

Documentation

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

Apply a Gonzalez fold

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

Apply a monadic Gonzalez fold

foldrAndContainer :: (forall x. (elem -> x -> x) -> x -> container -> x) -> container -> Unfoldr elem Source #

Construct from any value by supplying a definition of foldr

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

Construct from any foldable

intSet :: IntSet -> Unfoldr Int Source #

Elements of IntSet.

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

Filter the values given a predicate

enumsFrom :: Enum a => a -> Unfoldr a Source #

Ascending infinite stream of enums starting from the one specified

enumsInRange :: (Enum a, Ord a) => a -> a -> Unfoldr a Source #

Enums in the specified inclusive range

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

hashMapKeys :: HashMap key value -> Unfoldr key Source #

Keys of a hash-map

hashMapAssocs :: HashMap key value -> Unfoldr (key, value) Source #

Associations of a hash-map

hashMapAt :: (Hashable key, Eq key) => HashMap key value -> key -> Unfoldr value Source #

Value of a hash-map by key

hashMapValue :: (Hashable key, Eq key) => key -> HashMap key value -> Unfoldr value Source #

Deprecated: Use hashMapAt instead

Value of a hash-map by key

hashMapValues :: (Hashable key, Eq key) => HashMap key value -> Unfoldr key -> Unfoldr value Source #

Values of a hash-map by their keys

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

vector :: Vector vector a => vector a -> Unfoldr a Source #

Elements of a vector

vectorWithIndices :: Vector vector a => vector a -> Unfoldr (Int, a) Source #

Elements of a vector coming paired with indices

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

Binary digits of a non-negative integral number.

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

Binary digits of a non-negative integral number in reverse order.

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

Octal digits of a non-negative integral number.

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

Octal digits of a non-negative integral number in reverse order.

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

Decimal digits of a non-negative integral number.

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

Decimal digits of a non-negative integral number in reverse order. More efficient than decimalDigits.

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

Hexadecimal digits of a non-negative number.

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

Hexadecimal digits of a non-negative number in reverse order.

reverseDigits Source #

Arguments

:: Integral a 
=> a

Radix

-> a

Number

-> Unfoldr a 

Digits of a non-negative number in numeral system based on the specified radix. The digits come in reverse order.

E.g., here's how an unfold of binary digits in proper order looks:

binaryDigits :: Integral a => a -> Unfoldr a
binaryDigits = reverse . reverseDigits 2

reverse :: Unfoldr a -> Unfoldr a Source #

Reverse the order.

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

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

Lift into an unfold, which produces pairs with index.

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

Deprecated: This function builds up stack. Use zipWithIndex instead.

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

setBitIndices :: FiniteBits a => a -> Unfoldr Int Source #

Indices of set bits.

unsetBitIndices :: FiniteBits a => a -> Unfoldr Int Source #

Indices of unset bits.

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

cons :: a -> Unfoldr a -> Unfoldr a Source #

snoc :: a -> Unfoldr a -> Unfoldr a Source #

intersperse :: a -> Unfoldr a -> Unfoldr a Source #

Insert a separator value between each element.

Behaves the same way as intersperse.

textChars :: Text -> Unfoldr Char Source #

Reproduces the behaviour of unpack.

Implementation is efficient and avoids allocation of an intermediate list.

textWords :: Text -> Unfoldr Text Source #

Reproduces the behaviour of words.

Implementation is efficient and avoids allocation of an intermediate list.

trimWhitespace :: Unfoldr Char -> Unfoldr Char Source #

Transformer of chars, replaces all space-like chars with space, all newline-like chars with \n, and trims their duplicate sequences to single-char. Oh yeah, it also trims whitespace from beginning and end.

Orphan instances

Monad Unfoldr Source # 
Instance details

Methods

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

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

return :: a -> Unfoldr a Source #

Functor Unfoldr Source # 
Instance details

Methods

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

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

Applicative Unfoldr Source # 
Instance details

Methods

pure :: a -> Unfoldr a Source #

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

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

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

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

Foldable Unfoldr Source # 
Instance details

Methods

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

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

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

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

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

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

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

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

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

toList :: Unfoldr a -> [a] Source #

null :: Unfoldr a -> Bool Source #

length :: Unfoldr a -> Int Source #

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

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

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

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

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

Traversable Unfoldr Source # 
Instance details

Methods

traverse :: Applicative f => (a -> f b) -> Unfoldr a -> f (Unfoldr b) Source #

sequenceA :: Applicative f => Unfoldr (f a) -> f (Unfoldr a) Source #

mapM :: Monad m => (a -> m b) -> Unfoldr a -> m (Unfoldr b) Source #

sequence :: Monad m => Unfoldr (m a) -> m (Unfoldr a) Source #

Alternative Unfoldr Source # 
Instance details

MonadPlus Unfoldr Source # 
Instance details

Methods

mzero :: Unfoldr a Source #

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

IsList (Unfoldr a) Source # 
Instance details

Associated Types

type Item (Unfoldr a) Source #

Methods

fromList :: [Item (Unfoldr a)] -> Unfoldr a Source #

fromListN :: Int -> [Item (Unfoldr a)] -> Unfoldr a Source #

toList :: Unfoldr a -> [Item (Unfoldr a)] Source #

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

Methods

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

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

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

Semigroup (Unfoldr a) Source # 
Instance details

Methods

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

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

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

Monoid (Unfoldr a) Source # 
Instance details