Skip to content

feat: add an iota walker / endofunctor method #1083

@poolcritter

Description

@poolcritter

Describe the feature

add a function of signature (Iota => Iota) => Iota to iotas that recursively walks the tree, visiting and replacing all iotas visited. for most iotas (and likely for the default impl, if we provide one), this is just def walk(f: Iota => Iota) = f(this). for lists, however, it would first apply f to all elements of the list, then pass a ListIota with the new iotas to f. addons likewise could provide implementations for their container iota types.

Additional context

hexal, for example, needs to walk the iota tree to handle replacing illegal iotas. currently, it relies on an explicit check for ListIota, then provides an IMappableIota extension point. however, this requires addon developers to be aware of hexal and requires them to add a dependency if they provide a container type. a default method on Iota would be much more discoverable, and wouldn't require adding an external dependency.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    📋 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions