unicode-data-0.4.0.1: Access Unicode Character Database (UCD)
Copyright(c) 2022 Composewell Technologies and Contributors
LicenseBSD-3-Clause
Maintainerstreamly@composewell.com
Stabilityexperimental
PortabilityGHC
Safe HaskellSafe-Inferred
LanguageHaskell2010

Unicode.Internal.Unfold

Description

Since: 0.3.1

Synopsis

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 #

(<$) :: a -> Step s b -> Step s a #

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.