keys-3.12.3: Keyed functors and containers

Safe Haskell | Safe-Inferred
Language | Haskell2010

Data.Key

Contents

- Keys
- Keyed functors
- Zippable functors
- Zipping keyed functors
- Indexable functors
- Safe Lookup
- Adjustable
- FoldableWithKey
- FoldableWithKey1
- TraversableWithKey
- TraversableWithKey1

Synopsis

- type family Key (f :: Type -> Type)
- class Functor f => Keyed (f :: Type -> Type) where
  - mapWithKey :: (Key f -> a -> b) -> f a -> f b
- (<#$>) :: Keyed f => (Key f -> a -> b) -> f a -> f b
- keyed :: Keyed f => f a -> f (Key f, a)
- class Functor f => Zip (f :: Type -> Type) where
  - zipWith :: (a -> b -> c) -> f a -> f b -> f c
  - zip :: f a -> f b -> f (a, b)
  - zap :: f (a -> b) -> f a -> f b
- class (Keyed f, Zip f) => ZipWithKey (f :: Type -> Type) where
  - zipWithKey :: (Key f -> a -> b -> c) -> f a -> f b -> f c
  - zapWithKey :: f (Key f -> a -> b) -> f a -> f b
- class Lookup f => Indexable (f :: Type -> Type) where
  - index :: f a -> Key f -> a
- (!) :: Indexable f => f a -> Key f -> a
- class Lookup (f :: Type -> Type) where
  - lookup :: Key f -> f a -> Maybe a
- lookupDefault :: Indexable f => Key f -> f a -> Maybe a
- class Functor f => Adjustable (f :: Type -> Type) where
  - adjust :: (a -> a) -> Key f -> f a -> f a
  - replace :: Key f -> a -> f a -> f a
- class Foldable t => FoldableWithKey (t :: Type -> Type) where
  - toKeyedList :: t a -> [(Key t, a)]
  - foldMapWithKey :: Monoid m => (Key t -> a -> m) -> t a -> m
  - foldrWithKey :: (Key t -> a -> b -> b) -> b -> t a -> b
  - foldlWithKey :: (b -> Key t -> a -> b) -> b -> t a -> b
- foldrWithKey' :: FoldableWithKey t => (Key t -> a -> b -> b) -> b -> t a -> b
- foldlWithKey' :: FoldableWithKey t => (b -> Key t -> a -> b) -> b -> t a -> b
- foldrWithKeyM :: (FoldableWithKey t, Monad m) => (Key t -> a -> b -> m b) -> b -> t a -> m b
- foldlWithKeyM :: (FoldableWithKey t, Monad m) => (b -> Key t -> a -> m b) -> b -> t a -> m b
- traverseWithKey_ :: (FoldableWithKey t, Applicative f) => (Key t -> a -> f b) -> t a -> f ()
- forWithKey_ :: (FoldableWithKey t, Applicative f) => t a -> (Key t -> a -> f b) -> f ()
- mapWithKeyM_ :: (FoldableWithKey t, Monad m) => (Key t -> a -> m b) -> t a -> m ()
- forWithKeyM_ :: (FoldableWithKey t, Monad m) => t a -> (Key t -> a -> m b) -> m ()
- concatMapWithKey :: FoldableWithKey t => (Key t -> a -> [b]) -> t a -> [b]
- anyWithKey :: FoldableWithKey t => (Key t -> a -> Bool) -> t a -> Bool
- allWithKey :: FoldableWithKey t => (Key t -> a -> Bool) -> t a -> Bool
- findWithKey :: FoldableWithKey t => (Key t -> a -> Bool) -> t a -> Maybe a
- class (Foldable1 t, FoldableWithKey t) => FoldableWithKey1 (t :: Type -> Type) where
  - foldMapWithKey1 :: Semigroup m => (Key t -> a -> m) -> t a -> m
- traverseWithKey1_ :: (FoldableWithKey1 t, Apply f) => (Key t -> a -> f b) -> t a -> f ()
- forWithKey1_ :: (FoldableWithKey1 t, Apply f) => t a -> (Key t -> a -> f b) -> f ()
- foldMapWithKeyDefault1 :: (FoldableWithKey1 t, Monoid m) => (Key t -> a -> m) -> t a -> m
- class (Keyed t, FoldableWithKey t, Traversable t) => TraversableWithKey (t :: Type -> Type) where
  - traverseWithKey :: Applicative f => (Key t -> a -> f b) -> t a -> f (t b)
  - mapWithKeyM :: Monad m => (Key t -> a -> m b) -> t a -> m (t b)
- forWithKey :: (TraversableWithKey t, Applicative f) => t a -> (Key t -> a -> f b) -> f (t b)
- forWithKeyM :: (TraversableWithKey t, Monad m) => t a -> (Key t -> a -> m b) -> m (t b)
- mapAccumWithKeyL :: TraversableWithKey t => (Key t -> a -> b -> (a, c)) -> a -> t b -> (a, t c)
- mapAccumWithKeyR :: TraversableWithKey t => (Key t -> a -> b -> (a, c)) -> a -> t b -> (a, t c)
- mapWithKeyDefault :: TraversableWithKey t => (Key t -> a -> b) -> t a -> t b
- foldMapWithKeyDefault :: (TraversableWithKey t, Monoid m) => (Key t -> a -> m) -> t a -> m
- class (Traversable1 t, FoldableWithKey1 t, TraversableWithKey t) => TraversableWithKey1 (t :: Type -> Type) where
  - traverseWithKey1 :: Apply f => (Key t -> a -> f b) -> t a -> f (t b)
- foldMapWithKey1Default :: (TraversableWithKey1 t, Semigroup m) => (Key t -> a -> m) -> t a -> m

# Keys

type family Key (f :: Type -> Type) #

#### Instances

Instances details

type Key IntMap # |
Instance details Defined in Data.Key type Key IntMap = Int
type Key Seq # |
Instance details Defined in Data.Key type Key Seq = Int
type Key Tree # |
Instance details Defined in Data.Key type Key Tree = Seq Int
type Key NonEmpty # |
Instance details Defined in Data.Key type Key NonEmpty = Int
type Key Identity # |
Instance details Defined in Data.Key type Key Identity = ()
type Key ZipList # |
Instance details Defined in Data.Key type Key ZipList = Int
type Key Par1 # |
Instance details Defined in Data.Key type Key Par1 = ()
type Key Maybe # |
Instance details Defined in Data.Key type Key Maybe = ()
type Key [] # |
Instance details Defined in Data.Key type Key [] = Int
type Key (Map k) # |
Instance details Defined in Data.Key type Key (Map k) = k
type Key (Cofree f) # |
Instance details Defined in Data.Key type Key (Cofree f) = Seq (Key f)
type Key (Free f) # |
Instance details Defined in Data.Key type Key (Free f) = Seq (Key f)
type Key (Array i) # |
Instance details Defined in Data.Key type Key (Array i) = i
type Key (Proxy :: Type -> Type) # |
Instance details Defined in Data.Key type Key (Proxy :: Type -> Type) = Void
type Key (U1 :: Type -> Type) # |
Instance details Defined in Data.Key type Key (U1 :: Type -> Type) = Void
type Key (V1 :: Type -> Type) # |
Instance details Defined in Data.Key type Key (V1 :: Type -> Type) = Void
type Key (HashMap k) # |
Instance details Defined in Data.Key type Key (HashMap k) = k
type Key ((,) k) # |
Instance details Defined in Data.Key type Key ((,) k) = k
type Key (TracedT s w) # |
Instance details Defined in Data.Key type Key (TracedT s w) = (s, Key w)
type Key (Const e :: Type -> Type) # |
Instance details Defined in Data.Key type Key (Const e :: Type -> Type) = Void
type Key (Rec1 f) # |
Instance details Defined in Data.Key type Key (Rec1 f) = Key f
type Key (Tagged a) # |
Instance details Defined in Data.Key type Key (Tagged a) = ()
type Key (IdentityT m) # |
Instance details Defined in Data.Key type Key (IdentityT m) = Key m
type Key (ReaderT e m) # |
Instance details Defined in Data.Key type Key (ReaderT e m) = (e, Key m)
type Key (Constant e :: Type -> Type) # |
Instance details Defined in Data.Key type Key (Constant e :: Type -> Type) = Void
type Key (Product f g) # |
Instance details Defined in Data.Key type Key (Product f g) = Either (Key f) (Key g)
type Key (Sum f g) # |
Instance details Defined in Data.Key type Key (Sum f g) = Either (Key f) (Key g)
type Key (f :*: g) # |
Instance details Defined in Data.Key type Key (f :*: g) = Either (Key f) (Key g)
type Key (f :+: g) # |
Instance details Defined in Data.Key type Key (f :+: g) = Either (Key f) (Key g)
type Key (K1 i c :: Type -> Type) # |
Instance details Defined in Data.Key type Key (K1 i c :: Type -> Type) = Void
type Key ((->) a) # |
Instance details Defined in Data.Key type Key ((->) a) = a
type Key (Compose f g) # |
Instance details Defined in Data.Key type Key (Compose f g) = (Key f, Key g)
type Key (g :.: f) # |
Instance details Defined in Data.Key type Key (g :.: f) = (Key g, Key f)
type Key (M1 i c f) # |
Instance details Defined in Data.Key type Key (M1 i c f) = Key f

# Keyed functors

class Functor f => Keyed (f :: Type -> Type) where #

Methods

mapWithKey :: (Key f -> a -> b) -> f a -> f b #

#### Instances

Instances details

Keyed IntMap # |
Instance details Defined in Data.Key Methods mapWithKey :: (Key IntMap -> a -> b) -> IntMap a -> IntMap b #
Keyed Seq # |
Instance details Defined in Data.Key Methods mapWithKey :: (Key Seq -> a -> b) -> Seq a -> Seq b #
Keyed Tree # |
Instance details Defined in Data.Key Methods mapWithKey :: (Key Tree -> a -> b) -> Tree a -> Tree b #
Keyed NonEmpty # |
Instance details Defined in Data.Key Methods mapWithKey :: (Key NonEmpty -> a -> b) -> NonEmpty a -> NonEmpty b #
Keyed Identity # |
Instance details Defined in Data.Key Methods mapWithKey :: (Key Identity -> a -> b) -> Identity a -> Identity b #
Keyed ZipList # |
Instance details Defined in Data.Key Methods mapWithKey :: (Key ZipList -> a -> b) -> ZipList a -> ZipList b #
Keyed Par1 # |
Instance details Defined in Data.Key Methods mapWithKey :: (Key Par1 -> a -> b) -> Par1 a -> Par1 b #
Keyed Maybe # |
Instance details Defined in Data.Key Methods mapWithKey :: (Key Maybe -> a -> b) -> Maybe a -> Maybe b #
Keyed [] # |
Instance details Defined in Data.Key Methods mapWithKey :: (Key [] -> a -> b) -> [a] -> [b] #
Keyed (Map k) # |
Instance details Defined in Data.Key Methods mapWithKey :: (Key (Map k) -> a -> b) -> Map k a -> Map k b #
Keyed f => Keyed (Cofree f) # |
Instance details Defined in Data.Key Methods mapWithKey :: (Key (Cofree f) -> a -> b) -> Cofree f a -> Cofree f b #
Keyed f => Keyed (Free f) # |
Instance details Defined in Data.Key Methods mapWithKey :: (Key (Free f) -> a -> b) -> Free f a -> Free f b #
Ix i => Keyed (Array i) # |
Instance details Defined in Data.Key Methods mapWithKey :: (Key (Array i) -> a -> b) -> Array i a -> Array i b #
Keyed (Proxy :: Type -> Type) # |
Instance details Defined in Data.Key Methods mapWithKey :: (Key (Proxy :: Type -> Type) -> a -> b) -> Proxy a -> Proxy b #
Keyed (U1 :: Type -> Type) # |
Instance details Defined in Data.Key Methods mapWithKey :: (Key (U1 :: Type -> Type) -> a -> b) -> U1 a -> U1 b #
Keyed (V1 :: Type -> Type) # |
Instance details Defined in Data.Key Methods mapWithKey :: (Key (V1 :: Type -> Type) -> a -> b) -> V1 a -> V1 b #
Keyed (HashMap k) # |
Instance details Defined in Data.Key Methods mapWithKey :: (Key (HashMap k) -> a -> b) -> HashMap k a -> HashMap k b #
Keyed ((,) k) # |
Instance details Defined in Data.Key Methods mapWithKey :: (Key ((,) k) -> a -> b) -> (k, a) -> (k, b) #
Keyed w => Keyed (TracedT s w) # |
Instance details Defined in Data.Key Methods mapWithKey :: (Key (TracedT s w) -> a -> b) -> TracedT s w a -> TracedT s w b #
Keyed (Const e :: Type -> Type) # |
Instance details Defined in Data.Key Methods mapWithKey :: (Key (Const e :: Type -> Type) -> a -> b) -> Const e a -> Const e b #
Keyed f => Keyed (Rec1 f) # |
Instance details Defined in Data.Key Methods mapWithKey :: (Key (Rec1 f) -> a -> b) -> Rec1 f a -> Rec1 f b #
Keyed (Tagged a) # |
Instance details Defined in Data.Key Methods mapWithKey :: (Key (Tagged a) -> a0 -> b) -> Tagged a a0 -> Tagged a b #
Keyed m => Keyed (IdentityT m) # |
Instance details Defined in Data.Key Methods mapWithKey :: (Key (IdentityT m) -> a -> b) -> IdentityT m a -> IdentityT m b #
Keyed m => Keyed (ReaderT e m) # |
Instance details Defined in Data.Key Methods mapWithKey :: (Key (ReaderT e m) -> a -> b) -> ReaderT e m a -> ReaderT e m b #
Keyed (Constant e :: Type -> Type) # |
Instance details Defined in Data.Key Methods mapWithKey :: (Key (Constant e :: Type -> Type) -> a -> b) -> Constant e a -> Constant e b #
(Keyed f, Keyed g) => Keyed (Product f g) # |
Instance details Defined in Data.Key Methods mapWithKey :: (Key (Product f g) -> a -> b) -> Product f g a -> Product f g b #
(Keyed f, Keyed g) => Keyed (Sum f g) # |
Instance details Defined in Data.Key Methods mapWithKey :: (Key (Sum f g) -> a -> b) -> Sum f g a -> Sum f g b #
(Keyed g, Keyed f) => Keyed (f :*: g) # |
Instance details Defined in Data.Key Methods mapWithKey :: (Key (f :*: g) -> a -> b) -> (f :*: g) a -> (f :*: g) b #
(Keyed g, Keyed f) => Keyed (f :+: g) # |
Instance details Defined in Data.Key Methods mapWithKey :: (Key (f :+: g) -> a -> b) -> (f :+: g) a -> (f :+: g) b #
Keyed (K1 i c :: Type -> Type) # |
Instance details Defined in Data.Key Methods mapWithKey :: (Key (K1 i c :: Type -> Type) -> a -> b) -> K1 i c a -> K1 i c b #
Keyed ((->) a) # |
Instance details Defined in Data.Key Methods mapWithKey :: (Key ((->) a) -> a0 -> b) -> (a -> a0) -> a -> b #
(Keyed f, Keyed g) => Keyed (Compose f g) # |
Instance details Defined in Data.Key Methods mapWithKey :: (Key (Compose f g) -> a -> b) -> Compose f g a -> Compose f g b #
(Keyed g, Keyed f) => Keyed (g :.: f) # |
Instance details Defined in Data.Key Methods mapWithKey :: (Key (g :.: f) -> a -> b) -> (g :.: f) a -> (g :.: f) b #
Keyed f => Keyed (M1 i c f) # |
Instance details Defined in Data.Key Methods mapWithKey :: (Key (M1 i c f) -> a -> b) -> M1 i c f a -> M1 i c f b #

(<#$>) :: Keyed f => (Key f -> a -> b) -> f a -> f b infixl 4 #

keyed :: Keyed f => f a -> f (Key f, a) #

# Zippable functors

class Functor f => Zip (f :: Type -> Type) where #

Laws:

    fmap fst (zip u u) = u
    fmap snd (zip u u) = u
    zip (fmap fst u) (fmap snd u) = u
    zip (flip (,)) x y = zip y x

Minimal complete definition

zipWith | zip

Methods

zipWith :: (a -> b -> c) -> f a -> f b -> f c #

zip :: f a -> f b -> f (a, b) #

zap :: f (a -> b) -> f a -> f b #

#### Instances

Instances details

Zip IntMap # |
Instance details Defined in Data.Key Methods zipWith :: (a -> b -> c) -> IntMap a -> IntMap b -> IntMap c # zip :: IntMap a -> IntMap b -> IntMap (a, b) # zap :: IntMap (a -> b) -> IntMap a -> IntMap b #
Zip Seq # |
Instance details Defined in Data.Key Methods zipWith :: (a -> b -> c) -> Seq a -> Seq b -> Seq c # zip :: Seq a -> Seq b -> Seq (a, b) # zap :: Seq (a -> b) -> Seq a -> Seq b #
Zip Tree # |
Instance details Defined in Data.Key Methods zipWith :: (a -> b -> c) -> Tree a -> Tree b -> Tree c # zip :: Tree a -> Tree b -> Tree (a, b) # zap :: Tree (a -> b) -> Tree a -> Tree b #
Zip NonEmpty # |
Instance details Defined in Data.Key Methods zipWith :: (a -> b -> c) -> NonEmpty a -> NonEmpty b -> NonEmpty c # zip :: NonEmpty a -> NonEmpty b -> NonEmpty (a, b) # zap :: NonEmpty (a -> b) -> NonEmpty a -> NonEmpty b #
Zip Identity # |
Instance details Defined in Data.Key Methods zipWith :: (a -> b -> c) -> Identity a -> Identity b -> Identity c # zip :: Identity a -> Identity b -> Identity (a, b) # zap :: Identity (a -> b) -> Identity a -> Identity b #
Zip ZipList # |
Instance details Defined in Data.Key Methods zipWith :: (a -> b -> c) -> ZipList a -> ZipList b -> ZipList c # zip :: ZipList a -> ZipList b -> ZipList (a, b) # zap :: ZipList (a -> b) -> ZipList a -> ZipList b #
Zip Par1 # |
Instance details Defined in Data.Key Methods zipWith :: (a -> b -> c) -> Par1 a -> Par1 b -> Par1 c # zip :: Par1 a -> Par1 b -> Par1 (a, b) # zap :: Par1 (a -> b) -> Par1 a -> Par1 b #
Zip Maybe # |
Instance details Defined in Data.Key Methods zipWith :: (a -> b -> c) -> Maybe a -> Maybe b -> Maybe c # zip :: Maybe a -> Maybe b -> Maybe (a, b) # zap :: Maybe (a -> b) -> Maybe a -> Maybe b #
Zip [] # |
Instance details Defined in Data.Key Methods zipWith :: (a -> b -> c) -> [a] -> [b] -> [c] # zip :: [a] -> [b] -> [(a, b)] # zap :: [a -> b] -> [a] -> [b] #
Ord k => Zip (Map k) # |
Instance details Defined in Data.Key Methods zipWith :: (a -> b -> c) -> Map k a -> Map k b -> Map k c # zip :: Map k a -> Map k b -> Map k (a, b) # zap :: Map k (a -> b) -> Map k a -> Map k b #
Zip f => Zip (Cofree f) # |
Instance details Defined in Data.Key Methods zipWith :: (a -> b -> c) -> Cofree f a -> Cofree f b -> Cofree f c # zip :: Cofree f a -> Cofree f b -> Cofree f (a, b) # zap :: Cofree f (a -> b) -> Cofree f a -> Cofree f b #
Zip (Proxy :: Type -> Type) # |
Instance details Defined in Data.Key Methods zipWith :: (a -> b -> c) -> Proxy a -> Proxy b -> Proxy c # zip :: Proxy a -> Proxy b -> Proxy (a, b) # zap :: Proxy (a -> b) -> Proxy a -> Proxy b #
Zip (U1 :: Type -> Type) # |
Instance details Defined in Data.Key Methods zipWith :: (a -> b -> c) -> U1 a -> U1 b -> U1 c # zip :: U1 a -> U1 b -> U1 (a, b) # zap :: U1 (a -> b) -> U1 a -> U1 b #
Zip (V1 :: Type -> Type) # |
Instance details Defined in Data.Key Methods zipWith :: (a -> b -> c) -> V1 a -> V1 b -> V1 c # zip :: V1 a -> V1 b -> V1 (a, b) # zap :: V1 (a -> b) -> V1 a -> V1 b #
(Eq k, Hashable k) => Zip (HashMap k) # |
Instance details Defined in Data.Key Methods zipWith :: (a -> b -> c) -> HashMap k a -> HashMap k b -> HashMap k c # zip :: HashMap k a -> HashMap k b -> HashMap k (a, b) # zap :: HashMap k (a -> b) -> HashMap k a -> HashMap k b #
Zip w => Zip (TracedT s w) # |
Instance details Defined in Data.Key Methods zipWith :: (a -> b -> c) -> TracedT s w a -> TracedT s w b -> TracedT s w c # zip :: TracedT s w a -> TracedT s w b -> TracedT s w (a, b) # zap :: TracedT s w (a -> b) -> TracedT s w a -> TracedT s w b #
Zip f => Zip (Rec1 f) # |
Instance details Defined in Data.Key Methods zipWith :: (a -> b -> c) -> Rec1 f a -> Rec1 f b -> Rec1 f c # zip :: Rec1 f a -> Rec1 f b -> Rec1 f (a, b) # zap :: Rec1 f (a -> b) -> Rec1 f a -> Rec1 f b #
Zip (Tagged a) # |
Instance details Defined in Data.Key Methods zipWith :: (a0 -> b -> c) -> Tagged a a0 -> Tagged a b -> Tagged a c # zip :: Tagged a a0 -> Tagged a b -> Tagged a (a0, b) # zap :: Tagged a (a0 -> b) -> Tagged a a0 -> Tagged a b #
Zip m => Zip (IdentityT m) # |
Instance details Defined in Data.Key Methods zipWith :: (a -> b -> c) -> IdentityT m a -> IdentityT m b -> IdentityT m c # zip :: IdentityT m a -> IdentityT m b -> IdentityT m (a, b) # zap :: IdentityT m (a -> b) -> IdentityT m a -> IdentityT m b #
Zip m => Zip (ReaderT e m) # |
Instance details Defined in Data.Key Methods zipWith :: (a -> b -> c) -> ReaderT e m a -> ReaderT e m b -> ReaderT e m c # zip :: ReaderT e m a -> ReaderT e m b -> ReaderT e m (a, b) # zap :: ReaderT e m (a -> b) -> ReaderT e m a -> ReaderT e m b #
(Zip f, Zip g) => Zip (Product f g) # |
Instance details Defined in Data.Key Methods zipWith :: (a -> b -> c) -> Product f g a -> Product f g b -> Product f g c # zip :: Product f g a -> Product f g b -> Product f g (a, b) # zap :: Product f g (a -> b) -> Product f g a -> Product f g b #
(Zip f, Zip g) => Zip (f :*: g) # |
Instance details Defined in Data.Key Methods zipWith :: (a -> b -> c) -> (f :*: g) a -> (f :*: g) b -> (f :*: g) c # zip :: (f :*: g) a -> (f :*: g) b -> (f :*: g) (a, b) # zap :: (f :*: g) (a -> b) -> (f :*: g) a -> (f :*: g) b #
Zip ((->) a) # |
Instance details Defined in Data.Key Methods zipWith :: (a0 -> b -> c) -> (a -> a0) -> (a -> b) -> a -> c # zip :: (a -> a0) -> (a -> b) -> a -> (a0, b) # zap :: (a -> (a0 -> b)) -> (a -> a0) -> a -> b #
(Zip f, Zip g) => Zip (Compose f g) # |
Instance details Defined in Data.Key Methods zipWith :: (a -> b -> c) -> Compose f g a -> Compose f g b -> Compose f g c # zip :: Compose f g a -> Compose f g b -> Compose f g (a, b) # zap :: Compose f g (a -> b) -> Compose f g a -> Compose f g b #
(Zip f, Zip g) => Zip (g :.: f) # |
Instance details Defined in Data.Key Methods zipWith :: (a -> b -> c) -> (g :.: f) a -> (g :.: f) b -> (g :.: f) c # zip :: (g :.: f) a -> (g :.: f) b -> (g :.: f) (a, b) # zap :: (g :.: f) (a -> b) -> (g :.: f) a -> (g :.: f) b #
Zip f => Zip (M1 i c f) # |
Instance details Defined in Data.Key Methods zipWith :: (a -> b -> c0) -> M1 i c f a -> M1 i c f b -> M1 i c f c0 # zip :: M1 i c f a -> M1 i c f b -> M1 i c f (a, b) # zap :: M1 i c f (a -> b) -> M1 i c f a -> M1 i c f b #

# Zipping keyed functors

class (Keyed f, Zip f) => ZipWithKey (f :: Type -> Type) where #

Minimal complete definition

Nothing

Methods

zipWithKey :: (Key f -> a -> b -> c) -> f a -> f b -> f c #

zapWithKey :: f (Key f -> a -> b) -> f a -> f b #

#### Instances

Instances details

ZipWithKey IntMap # |
Instance details Defined in Data.Key Methods zipWithKey :: (Key IntMap -> a -> b -> c) -> IntMap a -> IntMap b -> IntMap c # zapWithKey :: IntMap (Key IntMap -> a -> b) -> IntMap a -> IntMap b #
ZipWithKey Seq # |
Instance details Defined in Data.Key Methods zipWithKey :: (Key Seq -> a -> b -> c) -> Seq a -> Seq b -> Seq c # zapWithKey :: Seq (Key Seq -> a -> b) -> Seq a -> Seq b #
ZipWithKey Tree # |
Instance details Defined in Data.Key Methods zipWithKey :: (Key Tree -> a -> b -> c) -> Tree a -> Tree b -> Tree c # zapWithKey :: Tree (Key Tree -> a -> b) -> Tree a -> Tree b #
ZipWithKey NonEmpty # |
Instance details Defined in Data.Key Methods zipWithKey :: (Key NonEmpty -> a -> b -> c) -> NonEmpty a -> NonEmpty b -> NonEmpty c # zapWithKey :: NonEmpty (Key NonEmpty -> a -> b) -> NonEmpty a -> NonEmpty b #
ZipWithKey Identity # |
Instance details Defined in Data.Key Methods zipWithKey :: (Key Identity -> a -> b -> c) -> Identity a -> Identity b -> Identity c # zapWithKey :: Identity (Key Identity -> a -> b) -> Identity a -> Identity b #
ZipWithKey ZipList # |
Instance details Defined in Data.Key Methods zipWithKey :: (Key ZipList -> a -> b -> c) -> ZipList a -> ZipList b -> ZipList c # zapWithKey :: ZipList (Key ZipList -> a -> b) -> ZipList a -> ZipList b #
ZipWithKey Par1 # |
Instance details Defined in Data.Key Methods zipWithKey :: (Key Par1 -> a -> b -> c) -> Par1 a -> Par1 b -> Par1 c # zapWithKey :: Par1 (Key Par1 -> a -> b) -> Par1 a -> Par1 b #
ZipWithKey Maybe # |
Instance details Defined in Data.Key Methods zipWithKey :: (Key Maybe -> a -> b -> c) -> Maybe a -> Maybe b -> Maybe c # zapWithKey :: Maybe (Key Maybe -> a -> b) -> Maybe a -> Maybe b #
ZipWithKey [] # |
Instance details Defined in Data.Key Methods zipWithKey :: (Key [] -> a -> b -> c) -> [a] -> [b] -> [c] # zapWithKey :: [Key [] -> a -> b] -> [a] -> [b] #
Ord k => ZipWithKey (Map k) # |
Instance details Defined in Data.Key Methods zipWithKey :: (Key (Map k) -> a -> b -> c) -> Map k a -> Map k b -> Map k c # zapWithKey :: Map k (Key (Map k) -> a -> b) -> Map k a -> Map k b #
ZipWithKey f => ZipWithKey (Cofree f) # |
Instance details Defined in Data.Key Methods zipWithKey :: (Key (Cofree f) -> a -> b -> c) -> Cofree f a -> Cofree f b -> Cofree f c # zapWithKey :: Cofree f (Key (Cofree f) -> a -> b) -> Cofree f a -> Cofree f b #
ZipWithKey (Proxy :: Type -> Type) # |
Instance details Defined in Data.Key Methods zipWithKey :: (Key (Proxy :: Type -> Type) -> a -> b -> c) -> Proxy a -> Proxy b -> Proxy c # zapWithKey :: Proxy (Key (Proxy :: Type -> Type) -> a -> b) -> Proxy a -> Proxy b #
ZipWithKey (U1 :: Type -> Type) # |
Instance details Defined in Data.Key Methods zipWithKey :: (Key (U1 :: Type -> Type) -> a -> b -> c) -> U1 a -> U1 b -> U1 c # zapWithKey :: U1 (Key (U1 :: Type -> Type) -> a -> b) -> U1 a -> U1 b #
ZipWithKey (V1 :: Type -> Type) # |
Instance details Defined in Data.Key Methods zipWithKey :: (Key (V1 :: Type -> Type) -> a -> b -> c) -> V1 a -> V1 b -> V1 c # zapWithKey :: V1 (Key (V1 :: Type -> Type) -> a -> b) -> V1 a -> V1 b #
(Eq k, Hashable k) => ZipWithKey (HashMap k) # |
Instance details Defined in Data.Key Methods zipWithKey :: (Key (HashMap k) -> a -> b -> c) -> HashMap k a -> HashMap k b -> HashMap k c # zapWithKey :: HashMap k (Key (HashMap k) -> a -> b) -> HashMap k a -> HashMap k b #
ZipWithKey w => ZipWithKey (TracedT s w) # |
Instance details Defined in Data.Key Methods zipWithKey :: (Key (TracedT s w) -> a -> b -> c) -> TracedT s w a -> TracedT s w b -> TracedT s w c # zapWithKey :: TracedT s w (Key (TracedT s w) -> a -> b) -> TracedT s w a -> TracedT s w b #
ZipWithKey f => ZipWithKey (Rec1 f) # |
Instance details Defined in Data.Key Methods zipWithKey :: (Key (Rec1 f) -> a -> b -> c) -> Rec1 f a -> Rec1 f b -> Rec1 f c # zapWithKey :: Rec1 f (Key (Rec1 f) -> a -> b) -> Rec1 f a -> Rec1 f b #
ZipWithKey (Tagged a) # |
Instance details Defined in Data.Key Methods zipWithKey :: (Key (Tagged a) -> a0 -> b -> c) -> Tagged a a0 -> Tagged a b -> Tagged a c # zapWithKey :: Tagged a (Key (Tagged a) -> a0 -> b) -> Tagged a a0 -> Tagged a b #
ZipWithKey m => ZipWithKey (IdentityT m) # |
Instance details Defined in Data.Key Methods zipWithKey :: (Key (IdentityT m) -> a -> b -> c) -> IdentityT m a -> IdentityT m b -> IdentityT m c # zapWithKey :: IdentityT m (Key (IdentityT m) -> a -> b) -> IdentityT m a -> IdentityT m b #
ZipWithKey m => ZipWithKey (ReaderT e m) # |
Instance details Defined in Data.Key Methods zipWithKey :: (Key (ReaderT e m) -> a -> b -> c) -> ReaderT e m a -> ReaderT e m b -> ReaderT e m c # zapWithKey :: ReaderT e m (Key (ReaderT e m) -> a -> b) -> ReaderT e m a -> ReaderT e m b #
(ZipWithKey f, ZipWithKey g) => ZipWithKey (Product f g) # |
Instance details Defined in Data.Key Methods zipWithKey :: (Key (Product f g) -> a -> b -> c) -> Product f g a -> Product f g b -> Product f g c # zapWithKey :: Product f g (Key (Product f g) -> a -> b) -> Product f g a -> Product f g b #
(ZipWithKey f, ZipWithKey g) => ZipWithKey (f :*: g) # |
Instance details Defined in Data.Key Methods zipWithKey :: (Key (f :*: g) -> a -> b -> c) -> (f :*: g) a -> (f :*: g) b -> (f :*: g) c # zapWithKey :: (f :*: g) (Key (f :*: g) -> a -> b) -> (f :*: g) a -> (f :*: g) b #
ZipWithKey ((->) a) # |
Instance details Defined in Data.Key Methods zipWithKey :: (Key ((->) a) -> a0 -> b -> c) -> (a -> a0) -> (a -> b) -> a -> c # zapWithKey :: (a -> (Key ((->) a) -> a0 -> b)) -> (a -> a0) -> a -> b #
(ZipWithKey f, ZipWithKey g) => ZipWithKey (Compose f g) # |
Instance details Defined in Data.Key Methods zipWithKey :: (Key (Compose f g) -> a -> b -> c) -> Compose f g a -> Compose f g b -> Compose f g c # zapWithKey :: Compose f g (Key (Compose f g) -> a -> b) -> Compose f g a -> Compose f g b #
(ZipWithKey f, ZipWithKey g) => ZipWithKey (g :.: f) # |
Instance details Defined in Data.Key Methods zipWithKey :: (Key (g :.: f) -> a -> b -> c) -> (g :.: f) a -> (g :.: f) b -> (g :.: f) c # zapWithKey :: (g :.: f) (Key (g :.: f) -> a -> b) -> (g :.: f) a -> (g :.: f) b #
ZipWithKey f => ZipWithKey (M1 i c f) # |
Instance details Defined in Data.Key Methods zipWithKey :: (Key (M1 i c f) -> a -> b -> c0) -> M1 i c f a -> M1 i c f b -> M1 i c f c0 # zapWithKey :: M1 i c f (Key (M1 i c f) -> a -> b) -> M1 i c f a -> M1 i c f b #

# Indexable functors

class Lookup f => Indexable (f :: Type -> Type) where #

Methods

index :: f a -> Key f -> a #

#### Instances

Instances details

Indexable IntMap # |
Instance details Defined in Data.Key Methods index :: IntMap a -> Key IntMap -> a #
Indexable Seq # |
Instance details Defined in Data.Key Methods index :: Seq a -> Key Seq -> a #
Indexable Tree # |
Instance details Defined in Data.Key Methods index :: Tree a -> Key Tree -> a #
Indexable NonEmpty # |
Instance details Defined in Data.Key Methods index :: NonEmpty a -> Key NonEmpty -> a #
Indexable Identity # |
Instance details Defined in Data.Key Methods index :: Identity a -> Key Identity -> a #
Indexable ZipList # |
Instance details Defined in Data.Key Methods index :: ZipList a -> Key ZipList -> a #
Indexable Par1 # |
Instance details Defined in Data.Key Methods index :: Par1 a -> Key Par1 -> a #
Indexable Maybe # |
Instance details Defined in Data.Key Methods index :: Maybe a -> Key Maybe -> a #
Indexable [] # |
Instance details Defined in Data.Key Methods index :: [a] -> Key [] -> a #
Ord k => Indexable (Map k) # |
Instance details Defined in Data.Key Methods index :: Map k a -> Key (Map k) -> a #
Indexable f => Indexable (Cofree f) # |
Instance details Defined in Data.Key Methods index :: Cofree f a -> Key (Cofree f) -> a #
Ix i => Indexable (Array i) # |
Instance details Defined in Data.Key Methods index :: Array i a -> Key (Array i) -> a #
Indexable (Proxy :: Type -> Type) # |
Instance details Defined in Data.Key Methods index :: Proxy a -> Key (Proxy :: Type -> Type) -> a #
Indexable (U1 :: Type -> Type) # |
Instance details Defined in Data.Key Methods index :: U1 a -> Key (U1 :: Type -> Type) -> a #
(Eq k, Hashable k) => Indexable (HashMap k) # |
Instance details Defined in Data.Key Methods index :: HashMap k a -> Key (HashMap k) -> a #
Indexable w => Indexable (TracedT s w) # |
Instance details Defined in Data.Key Methods index :: TracedT s w a -> Key (TracedT s w) -> a #
Indexable (Const e :: Type -> Type) # |
Instance details Defined in Data.Key Methods index :: Const e a -> Key (Const e :: Type -> Type) -> a #
Indexable f => Indexable (Rec1 f) # |
Instance details Defined in Data.Key Methods index :: Rec1 f a -> Key (Rec1 f) -> a #
Indexable (Tagged a) # |
Instance details Defined in Data.Key Methods index :: Tagged a a0 -> Key (Tagged a) -> a0 #
Indexable m => Indexable (IdentityT m) # |
Instance details Defined in Data.Key Methods index :: IdentityT m a -> Key (IdentityT m) -> a #
Indexable m => Indexable (ReaderT e m) # |
Instance details Defined in Data.Key Methods index :: ReaderT e m a -> Key (ReaderT e m) -> a #
Indexable (Constant e :: Type -> Type) # |
Instance details Defined in Data.Key Methods index :: Constant e a -> Key (Constant e :: Type -> Type) -> a #
(Indexable f, Indexable g) => Indexable (Product f g) # |
Instance details Defined in Data.Key Methods index :: Product f g a -> Key (Product f g) -> a #
(Indexable f, Indexable g) => Indexable (Sum f g) # |
Instance details Defined in Data.Key Methods index :: Sum f g a -> Key (Sum f g) -> a #
(Indexable g, Indexable f) => Indexable (f :*: g) # |
Instance details Defined in Data.Key Methods index :: (f :*: g) a -> Key (f :*: g) -> a #
Indexable (K1 i c :: Type -> Type) # |
Instance details Defined in Data.Key Methods index :: K1 i c a -> Key (K1 i c :: Type -> Type) -> a #
Indexable ((->) a) # |
Instance details Defined in Data.Key Methods index :: (a -> a0) -> Key ((->) a) -> a0 #
(Indexable f, Indexable g) => Indexable (Compose f g) # |
Instance details Defined in Data.Key Methods index :: Compose f g a -> Key (Compose f g) -> a #
(Indexable g, Indexable f) => Indexable (g :.: f) # |
Instance details Defined in Data.Key Methods index :: (g :.: f) a -> Key (g :.: f) -> a #
Indexable f => Indexable (M1 i c f) # |
Instance details Defined in Data.Key Methods index :: M1 i c f a -> Key (M1 i c f) -> a #

(!) :: Indexable f => f a -> Key f -> a #

# Safe Lookup

class Lookup (f :: Type -> Type) where #

Methods

lookup :: Key f -> f a -> Maybe a #

#### Instances

Instances details

Lookup IntMap # |
Instance details Defined in Data.Key Methods lookup :: Key IntMap -> IntMap a -> Maybe a #
Lookup Seq # |
Instance details Defined in Data.Key Methods lookup :: Key Seq -> Seq a -> Maybe a #
Lookup Tree # |
Instance details Defined in Data.Key Methods lookup :: Key Tree -> Tree a -> Maybe a #
Lookup NonEmpty # |
Instance details Defined in Data.Key Methods lookup :: Key NonEmpty -> NonEmpty a -> Maybe a #
Lookup Identity # |
Instance details Defined in Data.Key Methods lookup :: Key Identity -> Identity a -> Maybe a #
Lookup ZipList # |
Instance details Defined in Data.Key Methods lookup :: Key ZipList -> ZipList a -> Maybe a #
Lookup Par1 # |
Instance details Defined in Data.Key Methods lookup :: Key Par1 -> Par1 a -> Maybe a #
Lookup Maybe # |
Instance details Defined in Data.Key Methods lookup :: Key Maybe -> Maybe a -> Maybe a #
Lookup [] # |
Instance details Defined in Data.Key Methods lookup :: Key [] -> [a] -> Maybe a #
Ord k => Lookup (Map k) # |
Instance details Defined in Data.Key Methods lookup :: Key (Map k) -> Map k a -> Maybe a #
Lookup f => Lookup (Cofree f) # |
Instance details Defined in Data.Key Methods lookup :: Key (Cofree f) -> Cofree f a -> Maybe a #
Lookup f => Lookup (Free f) # |
Instance details Defined in Data.Key Methods lookup :: Key (Free f) -> Free f a -> Maybe a #
Ix i => Lookup (Array i) # |
Instance details Defined in Data.Key Methods lookup :: Key (Array i) -> Array i a -> Maybe a #
Lookup (Proxy :: Type -> Type) # |
Instance details Defined in Data.Key Methods lookup :: Key (Proxy :: Type -> Type) -> Proxy a -> Maybe a #
Lookup (U1 :: Type -> Type) # |
Instance details Defined in Data.Key Methods lookup :: Key (U1 :: Type -> Type) -> U1 a -> Maybe a #
(Eq k, Hashable k) => Lookup (HashMap k) # |
Instance details Defined in Data.Key Methods lookup :: Key (HashMap k) -> HashMap k a -> Maybe a #
Lookup w => Lookup (TracedT s w) # |
Instance details Defined in Data.Key Methods lookup :: Key (TracedT s w) -> TracedT s w a -> Maybe a #
Lookup (Const e :: Type -> Type) # |
Instance details Defined in Data.Key Methods lookup :: Key (Const e :: Type -> Type) -> Const e a -> Maybe a #
Lookup f => Lookup (Rec1 f) # |
Instance details Defined in Data.Key Methods lookup :: Key (Rec1 f) -> Rec1 f a -> Maybe a #
Lookup (Tagged a) # |
Instance details Defined in Data.Key Methods lookup :: Key (Tagged a) -> Tagged a a0 -> Maybe a0 #
Lookup m => Lookup (IdentityT m) # |
Instance details Defined in Data.Key Methods lookup :: Key (IdentityT m) -> IdentityT m a -> Maybe a #
Lookup m => Lookup (ReaderT e m) # |
Instance details Defined in Data.Key Methods lookup :: Key (ReaderT e m) -> ReaderT e m a -> Maybe a #
Lookup (Constant e :: Type -> Type) # |
Instance details Defined in Data.Key Methods lookup :: Key (Constant e :: Type -> Type) -> Constant e a -> Maybe a #
(Lookup f, Lookup g) => Lookup (Product f g) # |
Instance details Defined in Data.Key Methods lookup :: Key (Product f g) -> Product f g a -> Maybe a #
(Lookup f, Lookup g) => Lookup (Sum f g) # |
Instance details Defined in Data.Key Methods lookup :: Key (Sum f g) -> Sum f g a -> Maybe a #
(Indexable g, Indexable f) => Lookup (f :*: g) # |
Instance details Defined in Data.Key Methods lookup :: Key (f :*: g) -> (f :*: g) a -> Maybe a #
Lookup (K1 i c :: Type -> Type) # |
Instance details Defined in Data.Key Methods lookup :: Key (K1 i c :: Type -> Type) -> K1 i c a -> Maybe a #
Lookup ((->) a) # |
Instance details Defined in Data.Key Methods lookup :: Key ((->) a) -> (a -> a0) -> Maybe a0 #
(Lookup f, Lookup g) => Lookup (Compose f g) # |
Instance details Defined in Data.Key Methods lookup :: Key (Compose f g) -> Compose f g a -> Maybe a #
(Indexable g, Indexable f) => Lookup (g :.: f) # |
Instance details Defined in Data.Key Methods lookup :: Key (g :.: f) -> (g :.: f) a -> Maybe a #
Lookup f => Lookup (M1 i c f) # |
Instance details Defined in Data.Key Methods lookup :: Key (M1 i c f) -> M1 i c f a -> Maybe a #

lookupDefault :: Indexable f => Key f -> f a -> Maybe a #

# Adjustable

class Functor f => Adjustable (f :: Type -> Type) where #

Minimal complete definition

adjust

Methods

adjust :: (a -> a) -> Key f -> f a -> f a #

replace :: Key f -> a -> f a -> f a #

#### Instances

Instances details

Adjustable IntMap # |
Instance details Defined in Data.Key Methods adjust :: (a -> a) -> Key IntMap -> IntMap a -> IntMap a # replace :: Key IntMap -> a -> IntMap a -> IntMap a #
Adjustable Seq # |
Instance details Defined in Data.Key Methods adjust :: (a -> a) -> Key Seq -> Seq a -> Seq a # replace :: Key Seq -> a -> Seq a -> Seq a #
Adjustable Tree # |
Instance details Defined in Data.Key Methods adjust :: (a -> a) -> Key Tree -> Tree a -> Tree a # replace :: Key Tree -> a -> Tree a -> Tree a #
Adjustable NonEmpty # |
Instance details Defined in Data.Key Methods adjust :: (a -> a) -> Key NonEmpty -> NonEmpty a -> NonEmpty a # replace :: Key NonEmpty -> a -> NonEmpty a -> NonEmpty a #
Adjustable Identity # |
Instance details Defined in Data.Key Methods adjust :: (a -> a) -> Key Identity -> Identity a -> Identity a # replace :: Key Identity -> a -> Identity a -> Identity a #
Adjustable ZipList # |
Instance details Defined in Data.Key Methods adjust :: (a -> a) -> Key ZipList -> ZipList a -> ZipList a # replace :: Key ZipList -> a -> ZipList a -> ZipList a #
Adjustable Par1 # |
Instance details Defined in Data.Key Methods adjust :: (a -> a) -> Key Par1 -> Par1 a -> Par1 a # replace :: Key Par1 -> a -> Par1 a -> Par1 a #
Adjustable [] # |
Instance details Defined in Data.Key Methods adjust :: (a -> a) -> Key [] -> [a] -> [a] # replace :: Key [] -> a -> [a] -> [a] #
Ord k => Adjustable (Map k) # |
Instance details Defined in Data.Key Methods adjust :: (a -> a) -> Key (Map k) -> Map k a -> Map k a # replace :: Key (Map k) -> a -> Map k a -> Map k a #
Adjustable f => Adjustable (Cofree f) # |
Instance details Defined in Data.Key Methods adjust :: (a -> a) -> Key (Cofree f) -> Cofree f a -> Cofree f a # replace :: Key (Cofree f) -> a -> Cofree f a -> Cofree f a #
Adjustable f => Adjustable (Free f) # |
Instance details Defined in Data.Key Methods adjust :: (a -> a) -> Key (Free f) -> Free f a -> Free f a # replace :: Key (Free f) -> a -> Free f a -> Free f a #
Ix i => Adjustable (Array i) # |
Instance details Defined in Data.Key Methods adjust :: (a -> a) -> Key (Array i) -> Array i a -> Array i a # replace :: Key (Array i) -> a -> Array i a -> Array i a #
Adjustable (Proxy :: Type -> Type) # |
Instance details Defined in Data.Key Methods adjust :: (a -> a) -> Key (Proxy :: Type -> Type) -> Proxy a -> Proxy a # replace :: Key (Proxy :: Type -> Type) -> a -> Proxy a -> Proxy a #
Adjustable (U1 :: Type -> Type) # |
Instance details Defined in Data.Key Methods adjust :: (a -> a) -> Key (U1 :: Type -> Type) -> U1 a -> U1 a # replace :: Key (U1 :: Type -> Type) -> a -> U1 a -> U1 a #
Adjustable (Const e :: Type -> Type) # |
Instance details Defined in Data.Key Methods adjust :: (a -> a) -> Key (Const e :: Type -> Type) -> Const e a -> Const e a # replace :: Key (Const e :: Type -> Type) -> a -> Const e a -> Const e a #
Adjustable f => Adjustable (Rec1 f) # |
Instance details Defined in Data.Key Methods adjust :: (a -> a) -> Key (Rec1 f) -> Rec1 f a -> Rec1 f a # replace :: Key (Rec1 f) -> a -> Rec1 f a -> Rec1 f a #
Adjustable (Tagged a) # |
Instance details Defined in Data.Key Methods adjust :: (a0 -> a0) -> Key (Tagged a) -> Tagged a a0 -> Tagged a a0 # replace :: Key (Tagged a) -> a0 -> Tagged a a0 -> Tagged a a0 #
Adjustable (Constant e :: Type -> Type) # |
Instance details Defined in Data.Key Methods adjust :: (a -> a) -> Key (Constant e :: Type -> Type) -> Constant e a -> Constant e a # replace :: Key (Constant e :: Type -> Type) -> a -> Constant e a -> Constant e a #
(Adjustable f, Adjustable g) => Adjustable (Product f g) # |
Instance details Defined in Data.Key Methods adjust :: (a -> a) -> Key (Product f g) -> Product f g a -> Product f g a # replace :: Key (Product f g) -> a -> Product f g a -> Product f g a #
(Adjustable f, Adjustable g) => Adjustable (Sum f g) # |
Instance details Defined in Data.Key Methods adjust :: (a -> a) -> Key (Sum f g) -> Sum f g a -> Sum f g a # replace :: Key (Sum f g) -> a -> Sum f g a -> Sum f g a #
(Adjustable f, Adjustable g) => Adjustable (f :*: g) # |
Instance details Defined in Data.Key Methods adjust :: (a -> a) -> Key (f :*: g) -> (f :*: g) a -> (f :*: g) a # replace :: Key (f :*: g) -> a -> (f :*: g) a -> (f :*: g) a #
(Adjustable f, Adjustable g) => Adjustable (f :+: g) # |
Instance details Defined in Data.Key Methods adjust :: (a -> a) -> Key (f :+: g) -> (f :+: g) a -> (f :+: g) a # replace :: Key (f :+: g) -> a -> (f :+: g) a -> (f :+: g) a #
Adjustable (K1 i c :: Type -> Type) # |
Instance details Defined in Data.Key Methods adjust :: (a -> a) -> Key (K1 i c :: Type -> Type) -> K1 i c a -> K1 i c a # replace :: Key (K1 i c :: Type -> Type) -> a -> K1 i c a -> K1 i c a #
(Adjustable f, Adjustable g) => Adjustable (g :.: f) # |
Instance details Defined in Data.Key Methods adjust :: (a -> a) -> Key (g :.: f) -> (g :.: f) a -> (g :.: f) a # replace :: Key (g :.: f) -> a -> (g :.: f) a -> (g :.: f) a #
Adjustable f => Adjustable (M1 i c f) # |
Instance details Defined in Data.Key Methods adjust :: (a -> a) -> Key (M1 i c f) -> M1 i c f a -> M1 i c f a # replace :: Key (M1 i c f) -> a -> M1 i c f a -> M1 i c f a #

# FoldableWithKey

class Foldable t => FoldableWithKey (t :: Type -> Type) where #

Minimal complete definition

foldMapWithKey | foldrWithKey

Methods

toKeyedList :: t a -> [(Key t, a)] #

foldMapWithKey :: Monoid m => (Key t -> a -> m) -> t a -> m #

foldrWithKey :: (Key t -> a -> b -> b) -> b -> t a -> b #

foldlWithKey :: (b -> Key t -> a -> b) -> b -> t a -> b #

#### Instances

Instances details

FoldableWithKey IntMap # |
Instance details Defined in Data.Key Methods toKeyedList :: IntMap a -> [(Key IntMap, a)] # foldMapWithKey :: Monoid m => (Key IntMap -> a -> m) -> IntMap a -> m # foldrWithKey :: (Key IntMap -> a -> b -> b) -> b -> IntMap a -> b # foldlWithKey :: (b -> Key IntMap -> a -> b) -> b -> IntMap a -> b #
FoldableWithKey Seq # |
Instance details Defined in Data.Key Methods toKeyedList :: Seq a -> [(Key Seq, a)] # foldMapWithKey :: Monoid m => (Key Seq -> a -> m) -> Seq a -> m # foldrWithKey :: (Key Seq -> a -> b -> b) -> b -> Seq a -> b # foldlWithKey :: (b -> Key Seq -> a -> b) -> b -> Seq a -> b #
FoldableWithKey Tree # |
Instance details Defined in Data.Key Methods toKeyedList :: Tree a -> [(Key Tree, a)] # foldMapWithKey :: Monoid m => (Key Tree -> a -> m) -> Tree a -> m # foldrWithKey :: (Key Tree -> a -> b -> b) -> b -> Tree a -> b # foldlWithKey :: (b -> Key Tree -> a -> b) -> b -> Tree a -> b #
FoldableWithKey NonEmpty # |
Instance details Defined in Data.Key Methods toKeyedList :: NonEmpty a -> [(Key NonEmpty, a)] # foldMapWithKey :: Monoid m => (Key NonEmpty -> a -> m) -> NonEmpty a -> m # foldrWithKey :: (Key NonEmpty -> a -> b -> b) -> b -> NonEmpty a -> b # foldlWithKey :: (b -> Key NonEmpty -> a -> b) -> b -> NonEmpty a -> b #
FoldableWithKey Identity # |
Instance details Defined in Data.Key Methods toKeyedList :: Identity a -> [(Key Identity, a)] # foldMapWithKey :: Monoid m => (Key Identity -> a -> m) -> Identity a -> m # foldrWithKey :: (Key Identity -> a -> b -> b) -> b -> Identity a -> b # foldlWithKey :: (b -> Key Identity -> a -> b) -> b -> Identity a -> b #
FoldableWithKey ZipList # |
Instance details Defined in Data.Key Methods toKeyedList :: ZipList a -> [(Key ZipList, a)] # foldMapWithKey :: Monoid m => (Key ZipList -> a -> m) -> ZipList a -> m # foldrWithKey :: (Key ZipList -> a -> b -> b) -> b -> ZipList a -> b # foldlWithKey :: (b -> Key ZipList -> a -> b) -> b -> ZipList a -> b #
FoldableWithKey Par1 # |
Instance details Defined in Data.Key Methods toKeyedList :: Par1 a -> [(Key Par1, a)] # foldMapWithKey :: Monoid m => (Key Par1 -> a -> m) -> Par1 a -> m # foldrWithKey :: (Key Par1 -> a -> b -> b) -> b -> Par1 a -> b # foldlWithKey :: (b -> Key Par1 -> a -> b) -> b -> Par1 a -> b #
FoldableWithKey Maybe # |
Instance details Defined in Data.Key Methods toKeyedList :: Maybe a -> [(Key Maybe, a)] # foldMapWithKey :: Monoid m => (Key Maybe -> a -> m) -> Maybe a -> m # foldrWithKey :: (Key Maybe -> a -> b -> b) -> b -> Maybe a -> b # foldlWithKey :: (b -> Key Maybe -> a -> b) -> b -> Maybe a -> b #
FoldableWithKey [] # |
Instance details Defined in Data.Key Methods toKeyedList :: [a] -> [(Key [], a)] # foldMapWithKey :: Monoid m => (Key [] -> a -> m) -> [a] -> m # foldrWithKey :: (Key [] -> a -> b -> b) -> b -> [a] -> b # foldlWithKey :: (b -> Key [] -> a -> b) -> b -> [a] -> b #
FoldableWithKey (Map k) # |
Instance details Defined in Data.Key Methods toKeyedList :: Map k a -> [(Key (Map k), a)] # foldMapWithKey :: Monoid m => (Key (Map k) -> a -> m) -> Map k a -> m # foldrWithKey :: (Key (Map k) -> a -> b -> b) -> b -> Map k a -> b # foldlWithKey :: (b -> Key (Map k) -> a -> b) -> b -> Map k a -> b #
FoldableWithKey f => FoldableWithKey (Cofree f) # |
Instance details Defined in Data.Key Methods toKeyedList :: Cofree f a -> [(Key (Cofree f), a)] # foldMapWithKey :: Monoid m => (Key (Cofree f) -> a -> m) -> Cofree f a -> m # foldrWithKey :: (Key (Cofree f) -> a -> b -> b) -> b -> Cofree f a -> b # foldlWithKey :: (b -> Key (Cofree f) -> a -> b) -> b -> Cofree f a -> b #
FoldableWithKey f => FoldableWithKey (Free f) # |
Instance details Defined in Data.Key Methods toKeyedList :: Free f a -> [(Key (Free f), a)] # foldMapWithKey :: Monoid m => (Key (Free f) -> a -> m) -> Free f a -> m # foldrWithKey :: (Key (Free f) -> a -> b -> b) -> b -> Free f a -> b # foldlWithKey :: (b -> Key (Free f) -> a -> b) -> b -> Free f a -> b #
Ix i => FoldableWithKey (Array i) # |
Instance details Defined in Data.Key Methods toKeyedList :: Array i a -> [(Key (Array i), a)] # foldMapWithKey :: Monoid m => (Key (Array i) -> a -> m) -> Array i a -> m # foldrWithKey :: (Key (Array i) -> a -> b -> b) -> b -> Array i a -> b # foldlWithKey :: (b -> Key (Array i) -> a -> b) -> b -> Array i a -> b #
FoldableWithKey (Proxy :: Type -> Type) # |
Instance details Defined in Data.Key Methods toKeyedList :: Proxy a -> [(Key (Proxy :: Type -> Type), a)] # foldMapWithKey :: Monoid m => (Key (Proxy :: Type -> Type) -> a -> m) -> Proxy a -> m # foldrWithKey :: (Key (Proxy :: Type -> Type) -> a -> b -> b) -> b -> Proxy a -> b # foldlWithKey :: (b -> Key (Proxy :: Type -> Type) -> a -> b) -> b -> Proxy a -> b #
FoldableWithKey (U1 :: Type -> Type) # |
Instance details Defined in Data.Key Methods toKeyedList :: U1 a -> [(Key (U1 :: Type -> Type), a)] # foldMapWithKey :: Monoid m => (Key (U1 :: Type -> Type) -> a -> m) -> U1 a -> m # foldrWithKey :: (Key (U1 :: Type -> Type) -> a -> b -> b) -> b -> U1 a -> b # foldlWithKey :: (b -> Key (U1 :: Type -> Type) -> a -> b) -> b -> U1 a -> b #
FoldableWithKey (V1 :: Type -> Type) # |
Instance details Defined in Data.Key Methods toKeyedList :: V1 a -> [(Key (V1 :: Type -> Type), a)] # foldMapWithKey :: Monoid m => (Key (V1 :: Type -> Type) -> a -> m) -> V1 a -> m # foldrWithKey :: (Key (V1 :: Type -> Type) -> a -> b -> b) -> b -> V1 a -> b # foldlWithKey :: (b -> Key (V1 :: Type -> Type) -> a -> b) -> b -> V1 a -> b #
FoldableWithKey (HashMap k) # |
Instance details Defined in Data.Key Methods toKeyedList :: HashMap k a -> [(Key (HashMap k), a)] # foldMapWithKey :: Monoid m => (Key (HashMap k) -> a -> m) -> HashMap k a -> m # foldrWithKey :: (Key (HashMap k) -> a -> b -> b) -> b -> HashMap k a -> b # foldlWithKey :: (b -> Key (HashMap k) -> a -> b) -> b -> HashMap k a -> b #
FoldableWithKey ((,) k) # |
Instance details Defined in Data.Key Methods toKeyedList :: (k, a) -> [(Key ((,) k), a)] # foldMapWithKey :: Monoid m => (Key ((,) k) -> a -> m) -> (k, a) -> m # foldrWithKey :: (Key ((,) k) -> a -> b -> b) -> b -> (k, a) -> b # foldlWithKey :: (b -> Key ((,) k) -> a -> b) -> b -> (k, a) -> b #
FoldableWithKey (Const e :: Type -> Type) # |
Instance details Defined in Data.Key Methods toKeyedList :: Const e a -> [(Key (Const e :: Type -> Type), a)] # foldMapWithKey :: Monoid m => (Key (Const e :: Type -> Type) -> a -> m) -> Const e a -> m # foldrWithKey :: (Key (Const e :: Type -> Type) -> a -> b -> b) -> b -> Const e a -> b # foldlWithKey :: (b -> Key (Const e :: Type -> Type) -> a -> b) -> b -> Const e a -> b #
FoldableWithKey f => FoldableWithKey (Rec1 f) # |
Instance details Defined in Data.Key Methods toKeyedList :: Rec1 f a -> [(Key (Rec1 f), a)] # foldMapWithKey :: Monoid m => (Key (Rec1 f) -> a -> m) -> Rec1 f a -> m # foldrWithKey :: (Key (Rec1 f) -> a -> b -> b) -> b -> Rec1 f a -> b # foldlWithKey :: (b -> Key (Rec1 f) -> a -> b) -> b -> Rec1 f a -> b #
FoldableWithKey (Tagged a) # |
Instance details Defined in Data.Key Methods toKeyedList :: Tagged a a0 -> [(Key (Tagged a), a0)] # foldMapWithKey :: Monoid m => (Key (Tagged a) -> a0 -> m) -> Tagged a a0 -> m # foldrWithKey :: (Key (Tagged a) -> a0 -> b -> b) -> b -> Tagged a a0 -> b # foldlWithKey :: (b -> Key (Tagged a) -> a0 -> b) -> b -> Tagged a a0 -> b #
FoldableWithKey m => FoldableWithKey (IdentityT m) # |
Instance details Defined in Data.Key Methods toKeyedList :: IdentityT m a -> [(Key (IdentityT m), a)] # foldMapWithKey :: Monoid m0 => (Key (IdentityT m) -> a -> m0) -> IdentityT m a -> m0 # foldrWithKey :: (Key (IdentityT m) -> a -> b -> b) -> b -> IdentityT m a -> b # foldlWithKey :: (b -> Key (IdentityT m) -> a -> b) -> b -> IdentityT m a -> b #
FoldableWithKey (Constant e :: Type -> Type) # |
Instance details Defined in Data.Key Methods toKeyedList :: Constant e a -> [(Key (Constant e :: Type -> Type), a)] # foldMapWithKey :: Monoid m => (Key (Constant e :: Type -> Type) -> a -> m) -> Constant e a -> m # foldrWithKey :: (Key (Constant e :: Type -> Type) -> a -> b -> b) -> b -> Constant e a -> b # foldlWithKey :: (b -> Key (Constant e :: Type -> Type) -> a -> b) -> b -> Constant e a -> b #
(FoldableWithKey f, FoldableWithKey g) => FoldableWithKey (Product f g) # |
Instance details Defined in Data.Key Methods toKeyedList :: Product f g a -> [(Key (Product f g), a)] # foldMapWithKey :: Monoid m => (Key (Product f g) -> a -> m) -> Product f g a -> m # foldrWithKey :: (Key (Product f g) -> a -> b -> b) -> b -> Product f g a -> b # foldlWithKey :: (b -> Key (Product f g) -> a -> b) -> b -> Product f g a -> b #
(FoldableWithKey f, FoldableWithKey g) => FoldableWithKey (Sum f g) # |
Instance details Defined in Data.Key Methods toKeyedList :: Sum f g a -> [(Key (Sum f g), a)] # foldMapWithKey :: Monoid m => (Key (Sum f g) -> a -> m) -> Sum f g a -> m # foldrWithKey :: (Key (Sum f g) -> a -> b -> b) -> b -> Sum f g a -> b # foldlWithKey :: (b -> Key (Sum f g) -> a -> b) -> b -> Sum f g a -> b #
(FoldableWithKey f, FoldableWithKey g) => FoldableWithKey (f :*: g) # |
Instance details Defined in Data.Key Methods toKeyedList :: (f :*: g) a -> [(Key (f :*: g), a)] # foldMapWithKey :: Monoid m => (Key (f :*: g) -> a -> m) -> (f :*: g) a -> m # foldrWithKey :: (Key (f :*: g) -> a -> b -> b) -> b -> (f :*: g) a -> b # foldlWithKey :: (b -> Key (f :*: g) -> a -> b) -> b -> (f :*: g) a -> b #
(FoldableWithKey f, FoldableWithKey g) => FoldableWithKey (f :+: g) # |
Instance details Defined in Data.Key Methods toKeyedList :: (f :+: g) a -> [(Key (f :+: g), a)] # foldMapWithKey :: Monoid m => (Key (f :+: g) -> a -> m) -> (f :+: g) a -> m # foldrWithKey :: (Key (f :+: g) -> a -> b -> b) -> b -> (f :+: g) a -> b # foldlWithKey :: (b -> Key (f :+: g) -> a -> b) -> b -> (f :+: g) a -> b #
FoldableWithKey (K1 i c :: Type -> Type) # |
Instance details Defined in Data.Key Methods toKeyedList :: K1 i c a -> [(Key (K1 i c :: Type -> Type), a)] # foldMapWithKey :: Monoid m => (Key (K1 i c :: Type -> Type) -> a -> m) -> K1 i c a -> m # foldrWithKey :: (Key (K1 i c :: Type -> Type) -> a -> b -> b) -> b -> K1 i c a -> b # foldlWithKey :: (b -> Key (K1 i c :: Type -> Type) -> a -> b) -> b -> K1 i c a -> b #
(FoldableWithKey f, FoldableWithKey m) => FoldableWithKey (Compose f m) # |
Instance details Defined in Data.Key Methods toKeyedList :: Compose f m a -> [(Key (Compose f m), a)] # foldMapWithKey :: Monoid m0 => (Key (Compose f m) -> a -> m0) -> Compose f m a -> m0 # foldrWithKey :: (Key (Compose f m) -> a -> b -> b) -> b -> Compose f m a -> b # foldlWithKey :: (b -> Key (Compose f m) -> a -> b) -> b -> Compose f m a -> b #
FoldableWithKey f => FoldableWithKey (M1 i c f) # |
Instance details Defined in Data.Key Methods toKeyedList :: M1 i c f a -> [(Key (M1 i c f), a)] # foldMapWithKey :: Monoid m => (Key (M1 i c f) -> a -> m) -> M1 i c f a -> m # foldrWithKey :: (Key (M1 i c f) -> a -> b -> b) -> b -> M1 i c f a -> b # foldlWithKey :: (b -> Key (M1 i c f) -> a -> b) -> b -> M1 i c f a -> b #

foldrWithKey' :: FoldableWithKey t => (Key t -> a -> b -> b) -> b -> t a -> b #

foldlWithKey' :: FoldableWithKey t => (b -> Key t -> a -> b) -> b -> t a -> b #

foldrWithKeyM :: (FoldableWithKey t, Monad m) => (Key t -> a -> b -> m b) -> b -> t a -> m b #

foldlWithKeyM :: (FoldableWithKey t, Monad m) => (b -> Key t -> a -> m b) -> b -> t a -> m b #

traverseWithKey_ :: (FoldableWithKey t, Applicative f) => (Key t -> a -> f b) -> t a -> f () #

forWithKey_ :: (FoldableWithKey t, Applicative f) => t a -> (Key t -> a -> f b) -> f () #

mapWithKeyM_ :: (FoldableWithKey t, Monad m) => (Key t -> a -> m b) -> t a -> m () #

forWithKeyM_ :: (FoldableWithKey t, Monad m) => t a -> (Key t -> a -> m b) -> m () #

concatMapWithKey :: FoldableWithKey t => (Key t -> a -> [b]) -> t a -> [b] #

anyWithKey :: FoldableWithKey t => (Key t -> a -> Bool) -> t a -> Bool #

allWithKey :: FoldableWithKey t => (Key t -> a -> Bool) -> t a -> Bool #

findWithKey :: FoldableWithKey t => (Key t -> a -> Bool) -> t a -> Maybe a #

# FoldableWithKey1

class (Foldable1 t, FoldableWithKey t) => FoldableWithKey1 (t :: Type -> Type) where #

Methods

foldMapWithKey1 :: Semigroup m => (Key t -> a -> m) -> t a -> m #

#### Instances

Instances details

FoldableWithKey1 Tree # |
Instance details Defined in Data.Key Methods foldMapWithKey1 :: Semigroup m => (Key Tree -> a -> m) -> Tree a -> m #
FoldableWithKey1 NonEmpty # |
Instance details Defined in Data.Key Methods foldMapWithKey1 :: Semigroup m => (Key NonEmpty -> a -> m) -> NonEmpty a -> m #
FoldableWithKey1 Identity # |
Instance details Defined in Data.Key Methods foldMapWithKey1 :: Semigroup m => (Key Identity -> a -> m) -> Identity a -> m #
FoldableWithKey1 Par1 # |
Instance details Defined in Data.Key Methods foldMapWithKey1 :: Semigroup m => (Key Par1 -> a -> m) -> Par1 a -> m #
FoldableWithKey1 f => FoldableWithKey1 (Cofree f) # |
Instance details Defined in Data.Key Methods foldMapWithKey1 :: Semigroup m => (Key (Cofree f) -> a -> m) -> Cofree f a -> m #
FoldableWithKey1 f => FoldableWithKey1 (Free f) # |
Instance details Defined in Data.Key Methods foldMapWithKey1 :: Semigroup m => (Key (Free f) -> a -> m) -> Free f a -> m #
FoldableWithKey1 (V1 :: Type -> Type) # |
Instance details Defined in Data.Key Methods foldMapWithKey1 :: Semigroup m => (Key (V1 :: Type -> Type) -> a -> m) -> V1 a -> m #
FoldableWithKey1 ((,) k) # |
Instance details Defined in Data.Key Methods foldMapWithKey1 :: Semigroup m => (Key ((,) k) -> a -> m) -> (k, a) -> m #
FoldableWithKey1 f => FoldableWithKey1 (Rec1 f) # |
Instance details Defined in Data.Key Methods foldMapWithKey1 :: Semigroup m => (Key (Rec1 f) -> a -> m) -> Rec1 f a -> m #
FoldableWithKey1 (Tagged a) # |
Instance details Defined in Data.Key Methods foldMapWithKey1 :: Semigroup m => (Key (Tagged a) -> a0 -> m) -> Tagged a a0 -> m #
FoldableWithKey1 m => FoldableWithKey1 (IdentityT m) # |
Instance details Defined in Data.Key Methods foldMapWithKey1 :: Semigroup m0 => (Key (IdentityT m) -> a -> m0) -> IdentityT m a -> m0 #
(FoldableWithKey1 f, FoldableWithKey1 g) => FoldableWithKey1 (Product f g) # |
Instance details Defined in Data.Key Methods foldMapWithKey1 :: Semigroup m => (Key (Product f g) -> a -> m) -> Product f g a -> m #
(FoldableWithKey1 f, FoldableWithKey1 g) => FoldableWithKey1 (Sum f g) # |
Instance details Defined in Data.Key Methods foldMapWithKey1 :: Semigroup m => (Key (Sum f g) -> a -> m) -> Sum f g a -> m #
(FoldableWithKey1 f, FoldableWithKey1 g) => FoldableWithKey1 (f :*: g) # |
Instance details Defined in Data.Key Methods foldMapWithKey1 :: Semigroup m => (Key (f :*: g) -> a -> m) -> (f :*: g) a -> m #
(FoldableWithKey1 f, FoldableWithKey1 g) => FoldableWithKey1 (f :+: g) # |
Instance details Defined in Data.Key Methods foldMapWithKey1 :: Semigroup m => (Key (f :+: g) -> a -> m) -> (f :+: g) a -> m #
(FoldableWithKey1 f, FoldableWithKey1 m) => FoldableWithKey1 (Compose f m) # |
Instance details Defined in Data.Key Methods foldMapWithKey1 :: Semigroup m0 => (Key (Compose f m) -> a -> m0) -> Compose f m a -> m0 #
FoldableWithKey1 f => FoldableWithKey1 (M1 i c f) # |
Instance details Defined in Data.Key Methods foldMapWithKey1 :: Semigroup m => (Key (M1 i c f) -> a -> m) -> M1 i c f a -> m #

traverseWithKey1_ :: (FoldableWithKey1 t, Apply f) => (Key t -> a -> f b) -> t a -> f () #

forWithKey1_ :: (FoldableWithKey1 t, Apply f) => t a -> (Key t -> a -> f b) -> f () #

foldMapWithKeyDefault1 :: (FoldableWithKey1 t, Monoid m) => (Key t -> a -> m) -> t a -> m #

# TraversableWithKey

class (Keyed t, FoldableWithKey t, Traversable t) => TraversableWithKey (t :: Type -> Type) where #

Minimal complete definition

traverseWithKey

Methods

traverseWithKey :: Applicative f => (Key t -> a -> f b) -> t a -> f (t b) #

mapWithKeyM :: Monad m => (Key t -> a -> m b) -> t a -> m (t b) #

#### Instances

Instances details

TraversableWithKey IntMap # |
Instance details Defined in Data.Key Methods traverseWithKey :: Applicative f => (Key IntMap -> a -> f b) -> IntMap a -> f (IntMap b) # mapWithKeyM :: Monad m => (Key IntMap -> a -> m b) -> IntMap a -> m (IntMap b) #
TraversableWithKey Seq # |
Instance details Defined in Data.Key Methods traverseWithKey :: Applicative f => (Key Seq -> a -> f b) -> Seq a -> f (Seq b) # mapWithKeyM :: Monad m => (Key Seq -> a -> m b) -> Seq a -> m (Seq b) #
TraversableWithKey Tree # |
Instance details Defined in Data.Key Methods traverseWithKey :: Applicative f => (Key Tree -> a -> f b) -> Tree a -> f (Tree b) # mapWithKeyM :: Monad m => (Key Tree -> a -> m b) -> Tree a -> m (Tree b) #
TraversableWithKey NonEmpty # |
Instance details Defined in Data.Key Methods traverseWithKey :: Applicative f => (Key NonEmpty -> a -> f b) -> NonEmpty a -> f (NonEmpty b) # mapWithKeyM :: Monad m => (Key NonEmpty -> a -> m b) -> NonEmpty a -> m (NonEmpty b) #
TraversableWithKey Identity # |
Instance details Defined in Data.Key Methods traverseWithKey :: Applicative f => (Key Identity -> a -> f b) -> Identity a -> f (Identity b) # mapWithKeyM :: Monad m => (Key Identity -> a -> m b) -> Identity a -> m (Identity b) #
TraversableWithKey ZipList # |
Instance details Defined in Data.Key Methods traverseWithKey :: Applicative f => (Key ZipList -> a -> f b) -> ZipList a -> f (ZipList b) # mapWithKeyM :: Monad m => (Key ZipList -> a -> m b) -> ZipList a -> m (ZipList b) #
TraversableWithKey Par1 # |
Instance details Defined in Data.Key Methods traverseWithKey :: Applicative f => (Key Par1 -> a -> f b) -> Par1 a -> f (Par1 b) # mapWithKeyM :: Monad m => (Key Par1 -> a -> m b) -> Par1 a -> m (Par1 b) #
TraversableWithKey Maybe # |
Instance details Defined in Data.Key Methods traverseWithKey :: Applicative f => (Key Maybe -> a -> f b) -> Maybe a -> f (Maybe b) # mapWithKeyM :: Monad m => (Key Maybe -> a -> m b) -> Maybe a -> m (Maybe b) #
TraversableWithKey [] # |
Instance details Defined in Data.Key Methods traverseWithKey :: Applicative f => (Key [] -> a -> f b) -> [a] -> f [b] # mapWithKeyM :: Monad m => (Key [] -> a -> m b) -> [a] -> m [b] #
TraversableWithKey (Map k) # |
Instance details Defined in Data.Key Methods traverseWithKey :: Applicative f => (Key (Map k) -> a -> f b) -> Map k a -> f (Map k b) # mapWithKeyM :: Monad m => (Key (Map k) -> a -> m b) -> Map k a -> m (Map k b) #
TraversableWithKey f => TraversableWithKey (Cofree f) # |
Instance details Defined in Data.Key Methods traverseWithKey :: Applicative f0 => (Key (Cofree f) -> a -> f0 b) -> Cofree f a -> f0 (Cofree f b) # mapWithKeyM :: Monad m => (Key (Cofree f) -> a -> m b) -> Cofree f a -> m (Cofree f b) #
TraversableWithKey f => TraversableWithKey (Free f) # |
Instance details Defined in Data.Key Methods traverseWithKey :: Applicative f0 => (Key (Free f) -> a -> f0 b) -> Free f a -> f0 (Free f b) # mapWithKeyM :: Monad m => (Key (Free f) -> a -> m b) -> Free f a -> m (Free f b) #
Ix i => TraversableWithKey (Array i) # |
Instance details Defined in Data.Key Methods traverseWithKey :: Applicative f => (Key (Array i) -> a -> f b) -> Array i a -> f (Array i b) # mapWithKeyM :: Monad m => (Key (Array i) -> a -> m b) -> Array i a -> m (Array i b) #
TraversableWithKey (Proxy :: Type -> Type) # |
Instance details Defined in Data.Key Methods traverseWithKey :: Applicative f => (Key (Proxy :: Type -> Type) -> a -> f b) -> Proxy a -> f (Proxy b) # mapWithKeyM :: Monad m => (Key (Proxy :: Type -> Type) -> a -> m b) -> Proxy a -> m (Proxy b) #
TraversableWithKey (U1 :: Type -> Type) # |
Instance details Defined in Data.Key Methods traverseWithKey :: Applicative f => (Key (U1 :: Type -> Type) -> a -> f b) -> U1 a -> f (U1 b) # mapWithKeyM :: Monad m => (Key (U1 :: Type -> Type) -> a -> m b) -> U1 a -> m (U1 b) #
TraversableWithKey (V1 :: Type -> Type) # |
Instance details Defined in Data.Key Methods traverseWithKey :: Applicative f => (Key (V1 :: Type -> Type) -> a -> f b) -> V1 a -> f (V1 b) # mapWithKeyM :: Monad m => (Key (V1 :: Type -> Type) -> a -> m b) -> V1 a -> m (V1 b) #
TraversableWithKey (HashMap k) # |
Instance details Defined in Data.Key Methods traverseWithKey :: Applicative f => (Key (HashMap k) -> a -> f b) -> HashMap k a -> f (HashMap k b) # mapWithKeyM :: Monad m => (Key (HashMap k) -> a -> m b) -> HashMap k a -> m (HashMap k b) #
TraversableWithKey ((,) k) # |
Instance details Defined in Data.Key Methods traverseWithKey :: Applicative f => (Key ((,) k) -> a -> f b) -> (k, a) -> f (k, b) # mapWithKeyM :: Monad m => (Key ((,) k) -> a -> m b) -> (k, a) -> m (k, b) #
TraversableWithKey (Const e :: Type -> Type) # |
Instance details Defined in Data.Key Methods traverseWithKey :: Applicative f => (Key (Const e :: Type -> Type) -> a -> f b) -> Const e a -> f (Const e b) # mapWithKeyM :: Monad m => (Key (Const e :: Type -> Type) -> a -> m b) -> Const e a -> m (Const e b) #
TraversableWithKey f => TraversableWithKey (Rec1 f) # |
Instance details Defined in Data.Key Methods traverseWithKey :: Applicative f0 => (Key (Rec1 f) -> a -> f0 b) -> Rec1 f a -> f0 (Rec1 f b) # mapWithKeyM :: Monad m => (Key (Rec1 f) -> a -> m b) -> Rec1 f a -> m (Rec1 f b) #
TraversableWithKey (Tagged a) # |
Instance details Defined in Data.Key Methods traverseWithKey :: Applicative f => (Key (Tagged a) -> a0 -> f b) -> Tagged a a0 -> f (Tagged a b) # mapWithKeyM :: Monad m => (Key (Tagged a) -> a0 -> m b) -> Tagged a a0 -> m (Tagged a b) #
TraversableWithKey m => TraversableWithKey (IdentityT m) # |
Instance details Defined in Data.Key Methods traverseWithKey :: Applicative f => (Key (IdentityT m) -> a -> f b) -> IdentityT m a -> f (IdentityT m b) # mapWithKeyM :: Monad m0 => (Key (IdentityT m) -> a -> m0 b) -> IdentityT m a -> m0 (IdentityT m b) #
TraversableWithKey (Constant e :: Type -> Type) # |
Instance details Defined in Data.Key Methods traverseWithKey :: Applicative f => (Key (Constant e :: Type -> Type) -> a -> f b) -> Constant e a -> f (Constant e b) # mapWithKeyM :: Monad m => (Key (Constant e :: Type -> Type) -> a -> m b) -> Constant e a -> m (Constant e b) #
(TraversableWithKey f, TraversableWithKey g) => TraversableWithKey (Product f g) # |
Instance details Defined in Data.Key Methods traverseWithKey :: Applicative f0 => (Key (Product f g) -> a -> f0 b) -> Product f g a -> f0 (Product f g b) # mapWithKeyM :: Monad m => (Key (Product f g) -> a -> m b) -> Product f g a -> m (Product f g b) #
(TraversableWithKey f, TraversableWithKey g) => TraversableWithKey (Sum f g) # |
Instance details Defined in Data.Key Methods traverseWithKey :: Applicative f0 => (Key (Sum f g) -> a -> f0 b) -> Sum f g a -> f0 (Sum f g b) # mapWithKeyM :: Monad m => (Key (Sum f g) -> a -> m b) -> Sum f g a -> m (Sum f g b) #
(TraversableWithKey f, TraversableWithKey g) => TraversableWithKey (f :*: g) # |
Instance details Defined in Data.Key Methods traverseWithKey :: Applicative f0 => (Key (f :*: g) -> a -> f0 b) -> (f :*: g) a -> f0 ((f :*: g) b) # mapWithKeyM :: Monad m => (Key (f :*: g) -> a -> m b) -> (f :*: g) a -> m ((f :*: g) b) #
(TraversableWithKey f, TraversableWithKey g) => TraversableWithKey (f :+: g) # |
Instance details Defined in Data.Key Methods traverseWithKey :: Applicative f0 => (Key (f :+: g) -> a -> f0 b) -> (f :+: g) a -> f0 ((f :+: g) b) # mapWithKeyM :: Monad m => (Key (f :+: g) -> a -> m b) -> (f :+: g) a -> m ((f :+: g) b) #
TraversableWithKey (K1 i c :: Type -> Type) # |
Instance details Defined in Data.Key Methods traverseWithKey :: Applicative f => (Key (K1 i c :: Type -> Type) -> a -> f b) -> K1 i c a -> f (K1 i c b) # mapWithKeyM :: Monad m => (Key (K1 i c :: Type -> Type) -> a -> m b) -> K1 i c a -> m (K1 i c b) #
(TraversableWithKey f, TraversableWithKey m) => TraversableWithKey (Compose f m) # |
Instance details Defined in Data.Key Methods traverseWithKey :: Applicative f0 => (Key (Compose f m) -> a -> f0 b) -> Compose f m a -> f0 (Compose f m b) # mapWithKeyM :: Monad m0 => (Key (Compose f m) -> a -> m0 b) -> Compose f m a -> m0 (Compose f m b) #
TraversableWithKey f => TraversableWithKey (M1 i c f) # |
Instance details Defined in Data.Key Methods traverseWithKey :: Applicative f0 => (Key (M1 i c f) -> a -> f0 b) -> M1 i c f a -> f0 (M1 i c f b) # mapWithKeyM :: Monad m => (Key (M1 i c f) -> a -> m b) -> M1 i c f a -> m (M1 i c f b) #

forWithKey :: (TraversableWithKey t, Applicative f) => t a -> (Key t -> a -> f b) -> f (t b) #

forWithKeyM :: (TraversableWithKey t, Monad m) => t a -> (Key t -> a -> m b) -> m (t b) #

mapAccumWithKeyL :: TraversableWithKey t => (Key t -> a -> b -> (a, c)) -> a -> t b -> (a, t c) #

The `mapAccumWithKeyL` function behaves like a combination of `mapWithKey` and `foldlWithKey`; it applies a function to each element of a structure, passing an accumulating parameter from left to right, and returning a final value of this accumulator together with the new structure.

mapAccumWithKeyR :: TraversableWithKey t => (Key t -> a -> b -> (a, c)) -> a -> t b -> (a, t c) #

The `mapAccumWithKeyR` function behaves like a combination of `mapWithKey` and `foldrWithKey`; it applies a function to each element of a structure, passing an accumulating parameter from right to left, and returning a final value of this accumulator together with the new structure.

mapWithKeyDefault :: TraversableWithKey t => (Key t -> a -> b) -> t a -> t b #

foldMapWithKeyDefault :: (TraversableWithKey t, Monoid m) => (Key t -> a -> m) -> t a -> m #

This function may be used as a value for `foldMapWithKey` in a `FoldableWithKey` instance.

# TraversableWithKey1

class (Traversable1 t, FoldableWithKey1 t, TraversableWithKey t) => TraversableWithKey1 (t :: Type -> Type) where #

Methods

traverseWithKey1 :: Apply f => (Key t -> a -> f b) -> t a -> f (t b) #

#### Instances

Instances details

TraversableWithKey1 Tree # |
Instance details Defined in Data.Key Methods traverseWithKey1 :: Apply f => (Key Tree -> a -> f b) -> Tree a -> f (Tree b) #
TraversableWithKey1 NonEmpty # |
Instance details Defined in Data.Key Methods traverseWithKey1 :: Apply f => (Key NonEmpty -> a -> f b) -> NonEmpty a -> f (NonEmpty b) #
TraversableWithKey1 Identity # |
Instance details Defined in Data.Key Methods traverseWithKey1 :: Apply f => (Key Identity -> a -> f b) -> Identity a -> f (Identity b) #
TraversableWithKey1 Par1 # |
Instance details Defined in Data.Key Methods traverseWithKey1 :: Apply f => (Key Par1 -> a -> f b) -> Par1 a -> f (Par1 b) #
TraversableWithKey1 f => TraversableWithKey1 (Cofree f) # |
Instance details Defined in Data.Key Methods traverseWithKey1 :: Apply f0 => (Key (Cofree f) -> a -> f0 b) -> Cofree f a -> f0 (Cofree f b) #
TraversableWithKey1 f => TraversableWithKey1 (Free f) # |
Instance details Defined in Data.Key Methods traverseWithKey1 :: Apply f0 => (Key (Free f) -> a -> f0 b) -> Free f a -> f0 (Free f b) #
TraversableWithKey1 (V1 :: Type -> Type) # |
Instance details Defined in Data.Key Methods traverseWithKey1 :: Apply f => (Key (V1 :: Type -> Type) -> a -> f b) -> V1 a -> f (V1 b) #
TraversableWithKey1 ((,) k) # |
Instance details Defined in Data.Key Methods traverseWithKey1 :: Apply f => (Key ((,) k) -> a -> f b) -> (k, a) -> f (k, b) #
TraversableWithKey1 f => TraversableWithKey1 (Rec1 f) # |
Instance details Defined in Data.Key Methods traverseWithKey1 :: Apply f0 => (Key (Rec1 f) -> a -> f0 b) -> Rec1 f a -> f0 (Rec1 f b) #
TraversableWithKey1 (Tagged a) # |
Instance details Defined in Data.Key Methods traverseWithKey1 :: Apply f => (Key (Tagged a) -> a0 -> f b) -> Tagged a a0 -> f (Tagged a b) #
TraversableWithKey1 m => TraversableWithKey1 (IdentityT m) # |
Instance details Defined in Data.Key Methods traverseWithKey1 :: Apply f => (Key (IdentityT m) -> a -> f b) -> IdentityT m a -> f (IdentityT m b) #
(TraversableWithKey1 f, TraversableWithKey1 g) => TraversableWithKey1 (Product f g) # |
Instance details Defined in Data.Key Methods traverseWithKey1 :: Apply f0 => (Key (Product f g) -> a -> f0 b) -> Product f g a -> f0 (Product f g b) #
(TraversableWithKey1 f, TraversableWithKey1 g) => TraversableWithKey1 (Sum f g) # |
Instance details Defined in Data.Key Methods traverseWithKey1 :: Apply f0 => (Key (Sum f g) -> a -> f0 b) -> Sum f g a -> f0 (Sum f g b) #
(TraversableWithKey1 f, TraversableWithKey1 g) => TraversableWithKey1 (f :*: g) # |
Instance details Defined in Data.Key Methods traverseWithKey1 :: Apply f0 => (Key (f :*: g) -> a -> f0 b) -> (f :*: g) a -> f0 ((f :*: g) b) #
(TraversableWithKey1 f, TraversableWithKey1 g) => TraversableWithKey1 (f :+: g) # |
Instance details Defined in Data.Key Methods traverseWithKey1 :: Apply f0 => (Key (f :+: g) -> a -> f0 b) -> (f :+: g) a -> f0 ((f :+: g) b) #
(TraversableWithKey1 f, TraversableWithKey1 m) => TraversableWithKey1 (Compose f m) # |
Instance details Defined in Data.Key Methods traverseWithKey1 :: Apply f0 => (Key (Compose f m) -> a -> f0 b) -> Compose f m a -> f0 (Compose f m b) #
TraversableWithKey1 f => TraversableWithKey1 (M1 i c f) # |
Instance details Defined in Data.Key Methods traverseWithKey1 :: Apply f0 => (Key (M1 i c f) -> a -> f0 b) -> M1 i c f a -> f0 (M1 i c f b) #

foldMapWithKey1Default :: (TraversableWithKey1 t, Semigroup m) => (Key t -> a -> m) -> t a -> m #