talira

indexed-traversable

FunctorWithIndex, FoldableWithIndex and TraversableWithIndex for Haskell

open sourceBSD-2-Clausefree

indexed-traversable is a Haskell package that provides three generalizations of the standard classes: FunctorWithIndex (imap), FoldableWithIndex (ifoldMap) and TraversableWithIndex (itraverse), which pass each element's index to the function. It has instances for types in GHC's boot libraries, with more in the companion indexed-traversable-instances package. It was written by Edward Kmett and is maintained by Oleg Grenrus.

Problems it solves

  • map over a container with each element's index in Haskell
  • traverse a structure with indices in Haskell
  • use indexed folds without depending on lens

Features

  • FunctorWithIndex, FoldableWithIndex and TraversableWithIndex classes
  • instances for GHC boot library types
  • companion package with more instances