Module
Data.FunctorWithIndex 
- Package
- foldable-traversable
- Repository
- purerl/purescript-foldable-traversable
#FunctorWithIndex Source
class FunctorWithIndex :: Type -> (Type -> Type) -> Constraintclass (Functor f) <= FunctorWithIndex i f | f -> i where
A 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 a b. (i -> a -> b) -> f a -> f b
Instances
- FunctorWithIndex Int Array
- FunctorWithIndex Unit Maybe
- FunctorWithIndex Unit First
- FunctorWithIndex Unit Last
- FunctorWithIndex Unit Additive
- FunctorWithIndex Unit Dual
- FunctorWithIndex Unit Conj
- FunctorWithIndex Unit Disj
- FunctorWithIndex Unit Multiplicative
- FunctorWithIndex Unit (Either a)
- FunctorWithIndex Unit (Tuple a)
- FunctorWithIndex Unit Identity
- FunctorWithIndex Void (Const a)
- (FunctorWithIndex a f, FunctorWithIndex b g) => FunctorWithIndex (Either a b) (Product f g)
- (FunctorWithIndex a f, FunctorWithIndex b g) => FunctorWithIndex (Either a b) (Coproduct f g)
- (FunctorWithIndex a f, FunctorWithIndex b g) => FunctorWithIndex (Tuple a b) (Compose f g)
- (FunctorWithIndex a f) => FunctorWithIndex a (App f)
#mapDefault Source
mapDefault :: forall i f a b. FunctorWithIndex i f => (a -> b) -> f a -> f bA default implementation of Functor's map in terms of mapWithIndex