Skip to content

Can we get generateA? #144

Open
Open
@treeowl

Description

@treeowl
generateA :: Applicative f => Int -> (Int -> f a) -> f (Vector a)
-- specification
generateA n f = sequenceA (generate n f)

The Monad m constraint on generateM seems to flow from unstreamM. unstreamM, in turn, absolutely requires a Monad m constraint because of the way general streams are structured. For generating vectors, this all seems a bit sad, since the exact shape of the result stream is known in advance (a specific number of Yields followed by Done). I don't know that there's any way around that annoyance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions