Loading...

Unicode.Internal.Unfold

Since: 0.3.1

Documentation

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.

Since: 0.3.1

Constructors

forall s. Unfold 

Fields

  • (s -> Step s b)

    Step function: compute the next step from the current one.

  • (a -> Step s b)

    Inject function: initialize the state with a seed value.

data Step s a Source #

A stream is a succession of Steps.

Since: 0.3.1

Constructors

Yield !a !s

Produces a single value and the next state of the stream.

Stop

Indicates there are no more values in the stream.

Instances
Instances details
Functor (Step s) Source # 
Instance details

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.