Since: 0.3.1
data Unfold a b Source #
An Unfold a b is a generator of a stream of values of type b from a seed of type a.
Unfold a b
b
a
Constructors
Fields
Step function: compute the next step from the current one.
Inject function: initialize the state with a seed value.
data Step s a Source #
A stream is a succession of Steps.
Step
Produces a single value and the next state of the stream.
Indicates there are no more values in the stream.
Defined in Unicode.Internal.Unfold
Methods
fmap :: (a -> b) -> Step s a -> Step s b Source #
(<$) :: a -> Step s b -> Step s a Source #
toList :: Unfold a a -> a -> [a] Source #
Convert an 'Unfold a a' to a list [a], if the resulting list is empty the seed is used as a default output.