Module
Data.FunctorWithIndex
- Package
- purescript-foldable-traversable
- Repository
- purescript/purescript-foldable-traversable
#FunctorWithIndex Source
class (Functor f) <= FunctorWithIndex i f | f -> i whereA Functor with an additional index.
Instances must satisfy a modified form of the Functor laws
mapWithIndex (\_ a -> a) = identity
mapWithIndex f . mapWithIndex g = mapWithIndex (\i -> f i <<< g i)
and be compatible with the Functor instance
map f = mapWithIndex (const f)
Members
mapWithIndex :: forall b a. (i -> a -> b) -> f a -> f b
Instances
#mapDefault Source
mapDefault :: forall b a f i. FunctorWithIndex i f => (a -> b) -> f a -> f bA default implementation of Functor's map in terms of mapWithIndex