indexed-traversable

FunctorWithIndex, FoldableWithIndex, TraversableWithIndex

LTS Haskell 22.29:0.1.4
Stackage Nightly 2024-07-18:0.1.4
Latest on Hackage:0.1.4

See all snapshots indexed-traversable appears in

BSD-2-Clause licensed by Edward Kmett
Maintained by Oleg Grenrus
This version can be pinned in stack with:indexed-traversable-0.1.4@sha256:7e6eaeca52197856f3ab878fb31e30233dbb35b52a16441a42e4364b22b421e5,2061

Module documentation for 0.1.4

This package provides three useful generalizations:

class Functor f => FunctorWithIndex i f | f -> i where
  imap :: (i -> a -> b) -> f a -> f b
class Foldable f => FoldableWithIndex i f | f -> i where
  ifoldMap :: Monoid m => (i -> a -> m) -> f a -> m
class (FunctorWithIndex i t, FoldableWithIndex i t, Traversable t) => TraversableWithIndex i t | t -> i where
  itraverse :: Applicative f => (i -> a -> f b) -> t a -> f (t b)

This package contains instances for types in GHC boot libraries. For some additional instances see indexed-traversable-instances.

The keys package provides similar functionality, but uses (associated) TypeFamilies instead of FunctionalDependencies.

Changes

0.1.4 [2024-05-dd]

  • Drop support for GHCs prior 8.6.5

0.1.3 [2023-10-04]

  • Add Foldable1WithIndex1 type-class, an indexed version of Foldable1.

0.1.2.1 [2023-03-12]

0.1.2 [2021-10-30]

  • Changed (<$>) + (<*>) to liftA2 to potentially avoid extra fmap.
  • Add (#..), coercive composition after a 2-parameter function.
  • Switched references to lens ‘Of’- functions to base functions.

Thanks to wygulmage for contributions.

0.1.1 [2020-12-27]

0.1 [2020-12-15]

  • Split out and combine this package functionality from lens and optics