Skip to content

Add indexed Traversable #3

@treeowl

Description

@treeowl

There are notions of mapping, folding, and traversing available for type-aligned sequences:

class TAMappable t where
  tmap :: (forall x y . c x y -> d x y) -> t c p q -> t d p q

class TAFoldable f where
  tfoldMap :: Category d => (forall x y . c x y -> d x y) -> f c p q -> d p q

Either of the following (I'm not sure which is better):

class (TAMappable t, TAFoldable t) => TATraversable t where
  ttraverse :: IxApplicative m => (forall x y . c x y -> m y x (d x y)) -> t c p q -> m q p (t d p q)

class (TAMappable t, TAFoldable t) => TATraversable t where
  ttraverse :: IxApplicative m => (forall x y . c x y -> m x y (d x y)) -> t c p q -> m p q (t d p q)

The two options correspond to the traversals in each direction. If I'm not mistaken, they're related by IxBackwards (#2).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions