The test consumes a state and returns Bool; the output function maps a state to an element; and the transition preserves the state type. Hence the most general polymorphic type signature is
unfold :: (s -> Bool) -> (s -> a) -> (s -> s) -> s -> [a]
Equivalently, . The state and emitted element can have unrelated types. A list unfold produces the next element from the current state, then advances to a new state.

Articles by others on the same topic (0)

There are currently no matching articles.