| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Data.Key
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
- 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
- (!) :: Indexable f => f a -> Key f -> a
- class Lookup (f :: Type -> Type) where
- lookupDefault :: Indexable f => Key f -> f a -> Maybe a
- class Functor f => Adjustable (f :: Type -> Type) where
- 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) Source #
Instances
Keyed functors
class Functor f => Keyed (f :: Type -> Type) where Source #
Methods
mapWithKey :: (Key f -> a -> b) -> f a -> f b Source #
Instances
Zippable functors
class Functor f => Zip (f :: Type -> Type) where Source #
Laws:
fmapfst(zipu u) = ufmapsnd(zipu u) = uzip(fmapfstu) (fmapsndu) = uzip(flip(,)) x y =zipy x
Instances
| Zip IntMap Source # | |
| Zip Seq Source # | |
| Zip Tree Source # | |
| Zip NonEmpty Source # | |
| Zip Identity Source # | |
| Zip ZipList Source # | |
| Zip Par1 Source # | |
| Zip Maybe Source # | |
| Zip [] Source # | |
| Ord k => Zip (Map k) Source # | |
| Zip f => Zip (Cofree f) Source # | |
| Zip (Proxy :: Type -> Type) Source # | |
| Zip (U1 :: Type -> Type) Source # | |
| Zip (V1 :: Type -> Type) Source # | |
| (Eq k, Hashable k) => Zip (HashMap k) Source # | |
| Zip w => Zip (TracedT s w) Source # | |
| Zip f => Zip (Rec1 f) Source # | |
| Zip (Tagged a) Source # | |
| Zip m => Zip (IdentityT m) Source # | |
| Zip m => Zip (ReaderT e m) Source # | |
| (Zip f, Zip g) => Zip (Product f g) Source # | |
| (Zip f, Zip g) => Zip (f :*: g) Source # | |
| Zip ((->) a) Source # | |
| (Zip f, Zip g) => Zip (Compose f g) Source # | |
| (Zip f, Zip g) => Zip (g :.: f) Source # | |
| Zip f => Zip (M1 i c f) Source # | |
Zipping keyed functors
class (Keyed f, Zip f) => ZipWithKey (f :: Type -> Type) where Source #
Minimal complete definition
Nothing
Methods
zipWithKey :: (Key f -> a -> b -> c) -> f a -> f b -> f c Source #
zapWithKey :: f (Key f -> a -> b) -> f a -> f b Source #
Instances
Indexable functors
class Lookup f => Indexable (f :: Type -> Type) where Source #
Instances
Safe Lookup
class Lookup (f :: Type -> Type) where Source #
Instances
Adjustable
class Functor f => Adjustable (f :: Type -> Type) where Source #
Minimal complete definition
Instances
FoldableWithKey
class Foldable t => FoldableWithKey (t :: Type -> Type) where Source #
Minimal complete definition
Methods
toKeyedList :: t a -> [(Key t, a)] Source #
foldMapWithKey :: Monoid m => (Key t -> a -> m) -> t a -> m Source #
foldrWithKey :: (Key t -> a -> b -> b) -> b -> t a -> b Source #
foldlWithKey :: (b -> Key t -> a -> b) -> b -> t a -> b Source #
Instances
| FoldableWithKey IntMap Source # | |
Defined in Data.Key | |
| FoldableWithKey Seq Source # | |
| FoldableWithKey Tree Source # | |
| FoldableWithKey NonEmpty Source # | |
Defined in Data.Key Methods toKeyedList :: NonEmpty a -> [(Key NonEmpty, a)] Source # foldMapWithKey :: Monoid m => (Key NonEmpty -> a -> m) -> NonEmpty a -> m Source # foldrWithKey :: (Key NonEmpty -> a -> b -> b) -> b -> NonEmpty a -> b Source # foldlWithKey :: (b -> Key NonEmpty -> a -> b) -> b -> NonEmpty a -> b Source # | |
| FoldableWithKey Identity Source # | |
Defined in Data.Key Methods toKeyedList :: Identity a -> [(Key Identity, a)] Source # foldMapWithKey :: Monoid m => (Key Identity -> a -> m) -> Identity a -> m Source # foldrWithKey :: (Key Identity -> a -> b -> b) -> b -> Identity a -> b Source # foldlWithKey :: (b -> Key Identity -> a -> b) -> b -> Identity a -> b Source # | |
| FoldableWithKey ZipList Source # | |
Defined in Data.Key | |
| FoldableWithKey Par1 Source # | |
| FoldableWithKey Maybe Source # | |
| FoldableWithKey [] Source # | |
| FoldableWithKey (Map k) Source # | |
Defined in Data.Key | |
| FoldableWithKey f => FoldableWithKey (Cofree f) Source # | |
Defined in Data.Key Methods toKeyedList :: Cofree f a -> [(Key (Cofree f), a)] Source # foldMapWithKey :: Monoid m => (Key (Cofree f) -> a -> m) -> Cofree f a -> m Source # foldrWithKey :: (Key (Cofree f) -> a -> b -> b) -> b -> Cofree f a -> b Source # foldlWithKey :: (b -> Key (Cofree f) -> a -> b) -> b -> Cofree f a -> b Source # | |
| FoldableWithKey f => FoldableWithKey (Free f) Source # | |
Defined in Data.Key | |
| Ix i => FoldableWithKey (Array i) Source # | |
Defined in Data.Key Methods toKeyedList :: Array i a -> [(Key (Array i), a)] Source # foldMapWithKey :: Monoid m => (Key (Array i) -> a -> m) -> Array i a -> m Source # foldrWithKey :: (Key (Array i) -> a -> b -> b) -> b -> Array i a -> b Source # foldlWithKey :: (b -> Key (Array i) -> a -> b) -> b -> Array i a -> b Source # | |
| FoldableWithKey (Proxy :: Type -> Type) Source # | |
Defined in Data.Key Methods toKeyedList :: Proxy a -> [(Key (Proxy :: Type -> Type), a)] Source # foldMapWithKey :: Monoid m => (Key (Proxy :: Type -> Type) -> a -> m) -> Proxy a -> m Source # foldrWithKey :: (Key (Proxy :: Type -> Type) -> a -> b -> b) -> b -> Proxy a -> b Source # foldlWithKey :: (b -> Key (Proxy :: Type -> Type) -> a -> b) -> b -> Proxy a -> b Source # | |
| FoldableWithKey (U1 :: Type -> Type) Source # | |
Defined in Data.Key Methods toKeyedList :: U1 a -> [(Key (U1 :: Type -> Type), a)] Source # foldMapWithKey :: Monoid m => (Key (U1 :: Type -> Type) -> a -> m) -> U1 a -> m Source # foldrWithKey :: (Key (U1 :: Type -> Type) -> a -> b -> b) -> b -> U1 a -> b Source # foldlWithKey :: (b -> Key (U1 :: Type -> Type) -> a -> b) -> b -> U1 a -> b Source # | |
| FoldableWithKey (V1 :: Type -> Type) Source # | |
Defined in Data.Key Methods toKeyedList :: V1 a -> [(Key (V1 :: Type -> Type), a)] Source # foldMapWithKey :: Monoid m => (Key (V1 :: Type -> Type) -> a -> m) -> V1 a -> m Source # foldrWithKey :: (Key (V1 :: Type -> Type) -> a -> b -> b) -> b -> V1 a -> b Source # foldlWithKey :: (b -> Key (V1 :: Type -> Type) -> a -> b) -> b -> V1 a -> b Source # | |
| FoldableWithKey (HashMap k) Source # | |
Defined in Data.Key Methods toKeyedList :: HashMap k a -> [(Key (HashMap k), a)] Source # foldMapWithKey :: Monoid m => (Key (HashMap k) -> a -> m) -> HashMap k a -> m Source # foldrWithKey :: (Key (HashMap k) -> a -> b -> b) -> b -> HashMap k a -> b Source # foldlWithKey :: (b -> Key (HashMap k) -> a -> b) -> b -> HashMap k a -> b Source # | |
| FoldableWithKey ((,) k) Source # | |
Defined in Data.Key | |
| FoldableWithKey (Const e :: Type -> Type) Source # | |
Defined in Data.Key Methods toKeyedList :: Const e a -> [(Key (Const e :: Type -> Type), a)] Source # foldMapWithKey :: Monoid m => (Key (Const e :: Type -> Type) -> a -> m) -> Const e a -> m Source # foldrWithKey :: (Key (Const e :: Type -> Type) -> a -> b -> b) -> b -> Const e a -> b Source # foldlWithKey :: (b -> Key (Const e :: Type -> Type) -> a -> b) -> b -> Const e a -> b Source # | |
| FoldableWithKey f => FoldableWithKey (Rec1 f) Source # | |
Defined in Data.Key | |
| FoldableWithKey (Tagged a) Source # | |
Defined in Data.Key Methods toKeyedList :: Tagged a a0 -> [(Key (Tagged a), a0)] Source # foldMapWithKey :: Monoid m => (Key (Tagged a) -> a0 -> m) -> Tagged a a0 -> m Source # foldrWithKey :: (Key (Tagged a) -> a0 -> b -> b) -> b -> Tagged a a0 -> b Source # foldlWithKey :: (b -> Key (Tagged a) -> a0 -> b) -> b -> Tagged a a0 -> b Source # | |
| FoldableWithKey m => FoldableWithKey (IdentityT m) Source # | |
Defined in Data.Key Methods toKeyedList :: IdentityT m a -> [(Key (IdentityT m), a)] Source # foldMapWithKey :: Monoid m0 => (Key (IdentityT m) -> a -> m0) -> IdentityT m a -> m0 Source # foldrWithKey :: (Key (IdentityT m) -> a -> b -> b) -> b -> IdentityT m a -> b Source # foldlWithKey :: (b -> Key (IdentityT m) -> a -> b) -> b -> IdentityT m a -> b Source # | |
| FoldableWithKey (Constant e :: Type -> Type) Source # | |
Defined in Data.Key Methods toKeyedList :: Constant e a -> [(Key (Constant e :: Type -> Type), a)] Source # foldMapWithKey :: Monoid m => (Key (Constant e :: Type -> Type) -> a -> m) -> Constant e a -> m Source # foldrWithKey :: (Key (Constant e :: Type -> Type) -> a -> b -> b) -> b -> Constant e a -> b Source # foldlWithKey :: (b -> Key (Constant e :: Type -> Type) -> a -> b) -> b -> Constant e a -> b Source # | |
| (FoldableWithKey f, FoldableWithKey g) => FoldableWithKey (Product f g) Source # | |
Defined in Data.Key Methods toKeyedList :: Product f g a -> [(Key (Product f g), a)] Source # foldMapWithKey :: Monoid m => (Key (Product f g) -> a -> m) -> Product f g a -> m Source # foldrWithKey :: (Key (Product f g) -> a -> b -> b) -> b -> Product f g a -> b Source # foldlWithKey :: (b -> Key (Product f g) -> a -> b) -> b -> Product f g a -> b Source # | |
| (FoldableWithKey f, FoldableWithKey g) => FoldableWithKey (Sum f g) Source # | |
Defined in Data.Key Methods toKeyedList :: Sum f g a -> [(Key (Sum f g), a)] Source # foldMapWithKey :: Monoid m => (Key (Sum f g) -> a -> m) -> Sum f g a -> m Source # foldrWithKey :: (Key (Sum f g) -> a -> b -> b) -> b -> Sum f g a -> b Source # foldlWithKey :: (b -> Key (Sum f g) -> a -> b) -> b -> Sum f g a -> b Source # | |
| (FoldableWithKey f, FoldableWithKey g) => FoldableWithKey (f :*: g) Source # | |
Defined in Data.Key Methods toKeyedList :: (f :*: g) a -> [(Key (f :*: g), a)] Source # foldMapWithKey :: Monoid m => (Key (f :*: g) -> a -> m) -> (f :*: g) a -> m Source # foldrWithKey :: (Key (f :*: g) -> a -> b -> b) -> b -> (f :*: g) a -> b Source # foldlWithKey :: (b -> Key (f :*: g) -> a -> b) -> b -> (f :*: g) a -> b Source # | |
| (FoldableWithKey f, FoldableWithKey g) => FoldableWithKey (f :+: g) Source # | |
Defined in Data.Key Methods toKeyedList :: (f :+: g) a -> [(Key (f :+: g), a)] Source # foldMapWithKey :: Monoid m => (Key (f :+: g) -> a -> m) -> (f :+: g) a -> m Source # foldrWithKey :: (Key (f :+: g) -> a -> b -> b) -> b -> (f :+: g) a -> b Source # foldlWithKey :: (b -> Key (f :+: g) -> a -> b) -> b -> (f :+: g) a -> b Source # | |
| FoldableWithKey (K1 i c :: Type -> Type) Source # | |
Defined in Data.Key Methods toKeyedList :: K1 i c a -> [(Key (K1 i c :: Type -> Type), a)] Source # foldMapWithKey :: Monoid m => (Key (K1 i c :: Type -> Type) -> a -> m) -> K1 i c a -> m Source # foldrWithKey :: (Key (K1 i c :: Type -> Type) -> a -> b -> b) -> b -> K1 i c a -> b Source # foldlWithKey :: (b -> Key (K1 i c :: Type -> Type) -> a -> b) -> b -> K1 i c a -> b Source # | |
| (FoldableWithKey f, FoldableWithKey m) => FoldableWithKey (Compose f m) Source # | |
Defined in Data.Key Methods toKeyedList :: Compose f m a -> [(Key (Compose f m), a)] Source # foldMapWithKey :: Monoid m0 => (Key (Compose f m) -> a -> m0) -> Compose f m a -> m0 Source # foldrWithKey :: (Key (Compose f m) -> a -> b -> b) -> b -> Compose f m a -> b Source # foldlWithKey :: (b -> Key (Compose f m) -> a -> b) -> b -> Compose f m a -> b Source # | |
| FoldableWithKey f => FoldableWithKey (M1 i c f) Source # | |
Defined in Data.Key Methods toKeyedList :: M1 i c f a -> [(Key (M1 i c f), a)] Source # foldMapWithKey :: Monoid m => (Key (M1 i c f) -> a -> m) -> M1 i c f a -> m Source # foldrWithKey :: (Key (M1 i c f) -> a -> b -> b) -> b -> M1 i c f a -> b Source # foldlWithKey :: (b -> Key (M1 i c f) -> a -> b) -> b -> M1 i c f a -> b Source # | |
foldrWithKey' :: FoldableWithKey t => (Key t -> a -> b -> b) -> b -> t a -> b Source #
foldlWithKey' :: FoldableWithKey t => (b -> Key t -> a -> b) -> b -> t a -> b Source #
foldrWithKeyM :: (FoldableWithKey t, Monad m) => (Key t -> a -> b -> m b) -> b -> t a -> m b Source #
foldlWithKeyM :: (FoldableWithKey t, Monad m) => (b -> Key t -> a -> m b) -> b -> t a -> m b Source #
traverseWithKey_ :: (FoldableWithKey t, Applicative f) => (Key t -> a -> f b) -> t a -> f () Source #
forWithKey_ :: (FoldableWithKey t, Applicative f) => t a -> (Key t -> a -> f b) -> f () Source #
mapWithKeyM_ :: (FoldableWithKey t, Monad m) => (Key t -> a -> m b) -> t a -> m () Source #
forWithKeyM_ :: (FoldableWithKey t, Monad m) => t a -> (Key t -> a -> m b) -> m () Source #
concatMapWithKey :: FoldableWithKey t => (Key t -> a -> [b]) -> t a -> [b] Source #
anyWithKey :: FoldableWithKey t => (Key t -> a -> Bool) -> t a -> Bool Source #
allWithKey :: FoldableWithKey t => (Key t -> a -> Bool) -> t a -> Bool Source #
findWithKey :: FoldableWithKey t => (Key t -> a -> Bool) -> t a -> Maybe a Source #
FoldableWithKey1
class (Foldable1 t, FoldableWithKey t) => FoldableWithKey1 (t :: Type -> Type) where Source #
Methods
foldMapWithKey1 :: Semigroup m => (Key t -> a -> m) -> t a -> m Source #
Instances
| FoldableWithKey1 Tree Source # | |
| FoldableWithKey1 NonEmpty Source # | |
| FoldableWithKey1 Identity Source # | |
| FoldableWithKey1 Par1 Source # | |
| FoldableWithKey1 f => FoldableWithKey1 (Cofree f) Source # | |
| FoldableWithKey1 f => FoldableWithKey1 (Free f) Source # | |
| FoldableWithKey1 (V1 :: Type -> Type) Source # | |
| FoldableWithKey1 ((,) k) Source # | |
| FoldableWithKey1 f => FoldableWithKey1 (Rec1 f) Source # | |
| FoldableWithKey1 (Tagged a) Source # | |
| FoldableWithKey1 m => FoldableWithKey1 (IdentityT m) Source # | |
| (FoldableWithKey1 f, FoldableWithKey1 g) => FoldableWithKey1 (Product f g) Source # | |
| (FoldableWithKey1 f, FoldableWithKey1 g) => FoldableWithKey1 (Sum f g) Source # | |
| (FoldableWithKey1 f, FoldableWithKey1 g) => FoldableWithKey1 (f :*: g) Source # | |
| (FoldableWithKey1 f, FoldableWithKey1 g) => FoldableWithKey1 (f :+: g) Source # | |
| (FoldableWithKey1 f, FoldableWithKey1 m) => FoldableWithKey1 (Compose f m) Source # | |
| FoldableWithKey1 f => FoldableWithKey1 (M1 i c f) Source # | |
traverseWithKey1_ :: (FoldableWithKey1 t, Apply f) => (Key t -> a -> f b) -> t a -> f () Source #
forWithKey1_ :: (FoldableWithKey1 t, Apply f) => t a -> (Key t -> a -> f b) -> f () Source #
foldMapWithKeyDefault1 :: (FoldableWithKey1 t, Monoid m) => (Key t -> a -> m) -> t a -> m Source #
TraversableWithKey
class (Keyed t, FoldableWithKey t, Traversable t) => TraversableWithKey (t :: Type -> Type) where Source #
Minimal complete definition
Methods
traverseWithKey :: Applicative f => (Key t -> a -> f b) -> t a -> f (t b) Source #
mapWithKeyM :: Monad m => (Key t -> a -> m b) -> t a -> m (t b) Source #
Instances
forWithKey :: (TraversableWithKey t, Applicative f) => t a -> (Key t -> a -> f b) -> f (t b) Source #
forWithKeyM :: (TraversableWithKey t, Monad m) => t a -> (Key t -> a -> m b) -> m (t b) Source #
mapAccumWithKeyL :: TraversableWithKey t => (Key t -> a -> b -> (a, c)) -> a -> t b -> (a, t c) Source #
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) Source #
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 Source #
foldMapWithKeyDefault :: (TraversableWithKey t, Monoid m) => (Key t -> a -> m) -> t a -> m Source #
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 Source #
Methods
traverseWithKey1 :: Apply f => (Key t -> a -> f b) -> t a -> f (t b) Source #
Instances
foldMapWithKey1Default :: (TraversableWithKey1 t, Semigroup m) => (Key t -> a -> m) -> t a -> m Source #