| Safe Haskell | Safe |
|---|---|
| Language | Haskell2010 |
Data.Key
Contents
- type family Key (f :: * -> *)
- class Functor f => Keyed f where
- (<#$>) :: Keyed f => (Key f -> a -> b) -> f a -> f b
- keyed :: Keyed f => f a -> f (Key f, a)
- class Functor f => Zip f where
- class (Keyed f, Zip f) => ZipWithKey f where
- class Lookup f => Indexable f where
- (!) :: Indexable f => f a -> Key f -> a
- class Lookup f where
- lookupDefault :: Indexable f => Key f -> f a -> Maybe a
- class Functor f => Adjustable f where
- class Foldable t => FoldableWithKey t where
- 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 where
- 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 where
- 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 where
- foldMapWithKey1Default :: (TraversableWithKey1 t, Semigroup m) => (Key t -> a -> m) -> t a -> m
Keys
type family Key (f :: * -> *) #
Instances
| type Key [] # | |
| type Key Maybe # | |
| type Key Par1 # | |
| type Key NonEmpty # | |
| type Key ZipList # | |
| type Key Identity # | |
| type Key IntMap # | |
| type Key Tree # | |
| type Key Seq # | |
| type Key (V1 *) # | |
| type Key (U1 *) # | |
| type Key ((,) k) # | |
| type Key (Array i) # | |
| type Key (Proxy *) # | |
| type Key (Map k) # | |
| type Key (Cofree f) # | |
| type Key (Free f) # | |
| type Key (HashMap k) # | |
| type Key (Rec1 * f) # | |
| type Key (TracedT s w) # | |
| type Key (IdentityT * m) # | |
| type Key (Tagged * a) # | |
| type Key ((->) LiftedRep LiftedRep a) # | |
| type Key (K1 * i c) # | |
| type Key ((:+:) * f g) # | |
| type Key ((:*:) * f g) # | |
| type Key (Product * f g) # | |
| type Key (Sum * f g) # | |
| type Key (ReaderT * e m) # | |
| type Key (M1 * i c f) # | |
| type Key ((:.:) * * g f) # | |
| type Key (Compose * * f g) # | |
Keyed functors
class Functor f => Keyed f where #
Minimal complete definition
Methods
mapWithKey :: (Key f -> a -> b) -> f a -> f b #
Instances
| Keyed [] # | |
| Keyed Maybe # | |
| Keyed Par1 # | |
| Keyed NonEmpty # | |
| Keyed ZipList # | |
| Keyed Identity # | |
| Keyed IntMap # | |
| Keyed Tree # | |
| Keyed Seq # | |
| Keyed (V1 *) # | |
| Keyed (U1 *) # | |
| Keyed ((,) k) # | |
| Ix i => Keyed (Array i) # | |
| Keyed (Proxy *) # | |
| Keyed (Map k) # | |
| Keyed f => Keyed (Cofree f) # | |
| Keyed f => Keyed (Free f) # | |
| Keyed (HashMap k) # | |
| Keyed f => Keyed (Rec1 * f) # | |
| Keyed w => Keyed (TracedT s w) # | |
| Keyed m => Keyed (IdentityT * m) # | |
| Keyed (Tagged * a) # | |
| Keyed ((->) LiftedRep LiftedRep a) # | |
| Keyed (K1 * i c) # | |
| (Keyed g, Keyed f) => Keyed ((:+:) * f g) # | |
| (Keyed g, Keyed f) => Keyed ((:*:) * f g) # | |
| (Keyed f, Keyed g) => Keyed (Product * f g) # | |
| (Keyed f, Keyed g) => Keyed (Sum * f g) # | |
| Keyed m => Keyed (ReaderT * e m) # | |
| Keyed f => Keyed (M1 * i c f) # | |
| (Keyed g, Keyed f) => Keyed ((:.:) * * g f) # | |
| (Keyed f, Keyed g) => Keyed (Compose * * f g) # | |
Zippable functors
class Functor f => Zip f where #
Laws:
fmapfst(zipu u) = ufmapsnd(zipu u) = uzip(fmapfstu) (fmapsndu) = uzip(flip(,)) x y =zipy x
Instances
| Zip [] # | |
| Zip Maybe # | |
| Zip Par1 # | |
| Zip NonEmpty # | |
| Zip ZipList # | |
| Zip Identity # | |
| Zip IntMap # | |
| Zip Tree # | |
| Zip Seq # | |
| Zip (V1 *) # | |
| Zip (U1 *) # | |
| Zip (Proxy *) # | |
| Ord k => Zip (Map k) # | |
| Zip f => Zip (Cofree f) # | |
| (Eq k, Hashable k) => Zip (HashMap k) # | |
| Zip f => Zip (Rec1 * f) # | |
| Zip w => Zip (TracedT s w) # | |
| Zip m => Zip (IdentityT * m) # | |
| Zip (Tagged * a) # | |
| Zip ((->) LiftedRep LiftedRep a) # | |
| (Zip f, Zip g) => Zip ((:*:) * f g) # | |
| (Zip f, Zip g) => Zip (Product * f g) # | |
| Zip m => Zip (ReaderT * e m) # | |
| Zip f => Zip (M1 * i c f) # | |
| (Zip f, Zip g) => Zip ((:.:) * * g f) # | |
| (Zip f, Zip g) => Zip (Compose * * f g) # | |
Zipping keyed functors
class (Keyed f, Zip f) => ZipWithKey f where #
Methods
zipWithKey :: (Key f -> a -> b -> c) -> f a -> f b -> f c #
zapWithKey :: f (Key f -> a -> b) -> f a -> f b #
Instances
| ZipWithKey [] # | |
| ZipWithKey Maybe # | |
| ZipWithKey Par1 # | |
| ZipWithKey NonEmpty # | |
| ZipWithKey ZipList # | |
| ZipWithKey Identity # | |
| ZipWithKey IntMap # | |
| ZipWithKey Tree # | |
| ZipWithKey Seq # | |
| ZipWithKey (V1 *) # | |
| ZipWithKey (U1 *) # | |
| ZipWithKey (Proxy *) # | |
| Ord k => ZipWithKey (Map k) # | |
| ZipWithKey f => ZipWithKey (Cofree f) # | |
| (Eq k, Hashable k) => ZipWithKey (HashMap k) # | |
| ZipWithKey f => ZipWithKey (Rec1 * f) # | |
| ZipWithKey w => ZipWithKey (TracedT s w) # | |
| ZipWithKey m => ZipWithKey (IdentityT * m) # | |
| ZipWithKey (Tagged * a) # | |
| ZipWithKey ((->) LiftedRep LiftedRep a) # | |
| (ZipWithKey f, ZipWithKey g) => ZipWithKey ((:*:) * f g) # | |
| (ZipWithKey f, ZipWithKey g) => ZipWithKey (Product * f g) # | |
| ZipWithKey m => ZipWithKey (ReaderT * e m) # | |
| ZipWithKey f => ZipWithKey (M1 * i c f) # | |
| (ZipWithKey f, ZipWithKey g) => ZipWithKey ((:.:) * * g f) # | |
| (ZipWithKey f, ZipWithKey g) => ZipWithKey (Compose * * f g) # | |
Indexable functors
class Lookup f => Indexable f where #
Minimal complete definition
Instances
| Indexable [] # | |
| Indexable Maybe # | |
| Indexable Par1 # | |
| Indexable NonEmpty # | |
| Indexable ZipList # | |
| Indexable Identity # | |
| Indexable IntMap # | |
| Indexable Tree # | |
| Indexable Seq # | |
| Indexable (U1 *) # | |
| Ix i => Indexable (Array i) # | |
| Indexable (Proxy *) # | |
| Ord k => Indexable (Map k) # | |
| Indexable f => Indexable (Cofree f) # | |
| (Eq k, Hashable k) => Indexable (HashMap k) # | |
| Indexable f => Indexable (Rec1 * f) # | |
| Indexable w => Indexable (TracedT s w) # | |
| Indexable m => Indexable (IdentityT * m) # | |
| Indexable (Tagged * a) # | |
| Indexable ((->) LiftedRep LiftedRep a) # | |
| Indexable (K1 * i c) # | |
| (Indexable g, Indexable f) => Indexable ((:*:) * f g) # | |
| (Indexable f, Indexable g) => Indexable (Product * f g) # | |
| (Indexable f, Indexable g) => Indexable (Sum * f g) # | |
| Indexable m => Indexable (ReaderT * e m) # | |
| Indexable f => Indexable (M1 * i c f) # | |
| (Indexable g, Indexable f) => Indexable ((:.:) * * g f) # | |
| (Indexable f, Indexable g) => Indexable (Compose * * f g) # | |
Safe Lookup
Minimal complete definition
Instances
| Lookup [] # | |
| Lookup Maybe # | |
| Lookup Par1 # | |
| Lookup NonEmpty # | |
| Lookup ZipList # | |
| Lookup Identity # | |
| Lookup IntMap # | |
| Lookup Tree # | |
| Lookup Seq # | |
| Lookup (U1 *) # | |
| Ix i => Lookup (Array i) # | |
| Lookup (Proxy *) # | |
| Ord k => Lookup (Map k) # | |
| Lookup f => Lookup (Cofree f) # | |
| Lookup f => Lookup (Free f) # | |
| (Eq k, Hashable k) => Lookup (HashMap k) # | |
| Lookup f => Lookup (Rec1 * f) # | |
| Lookup w => Lookup (TracedT s w) # | |
| Lookup m => Lookup (IdentityT * m) # | |
| Lookup (Tagged * a) # | |
| Lookup ((->) LiftedRep LiftedRep a) # | |
| Lookup (K1 * i c) # | |
| (Indexable g, Indexable f) => Lookup ((:*:) * f g) # | |
| (Lookup f, Lookup g) => Lookup (Product * f g) # | |
| (Lookup f, Lookup g) => Lookup (Sum * f g) # | |
| Lookup m => Lookup (ReaderT * e m) # | |
| Lookup f => Lookup (M1 * i c f) # | |
| (Indexable g, Indexable f) => Lookup ((:.:) * * g f) # | |
| (Lookup f, Lookup g) => Lookup (Compose * * f g) # | |
lookupDefault :: Indexable f => Key f -> f a -> Maybe a #
Adjustable
class Functor f => Adjustable f where #
Minimal complete definition
Instances
| Adjustable [] # | |
| Adjustable Par1 # | |
| Adjustable NonEmpty # | |
| Adjustable ZipList # | |
| Adjustable Identity # | |
| Adjustable IntMap # | |
| Adjustable Tree # | |
| Adjustable Seq # | |
| Adjustable (U1 *) # | |
| Ix i => Adjustable (Array i) # | |
| Adjustable (Proxy *) # | |
| Ord k => Adjustable (Map k) # | |
| Adjustable f => Adjustable (Cofree f) # | |
| Adjustable f => Adjustable (Free f) # | |
| Adjustable f => Adjustable (Rec1 * f) # | |
| Adjustable (Tagged * a) # | |
| Adjustable (K1 * i c) # | |
| (Adjustable f, Adjustable g) => Adjustable ((:+:) * f g) # | |
| (Adjustable f, Adjustable g) => Adjustable ((:*:) * f g) # | |
| (Adjustable f, Adjustable g) => Adjustable (Product * f g) # | |
| (Adjustable f, Adjustable g) => Adjustable (Sum * f g) # | |
| Adjustable f => Adjustable (M1 * i c f) # | |
| (Adjustable f, Adjustable g) => Adjustable ((:.:) * * g f) # | |
FoldableWithKey
class Foldable t => FoldableWithKey t where #
Minimal complete definition
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
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 where #
Minimal complete definition
Methods
foldMapWithKey1 :: Semigroup m => (Key t -> a -> m) -> t a -> m #
Instances
| FoldableWithKey1 Par1 # | |
| FoldableWithKey1 NonEmpty # | |
| FoldableWithKey1 Identity # | |
| FoldableWithKey1 Tree # | |
| FoldableWithKey1 (V1 *) # | |
| FoldableWithKey1 ((,) k) # | |
| FoldableWithKey1 f => FoldableWithKey1 (Cofree f) # | |
| FoldableWithKey1 f => FoldableWithKey1 (Free f) # | |
| FoldableWithKey1 f => FoldableWithKey1 (Rec1 * f) # | |
| FoldableWithKey1 m => FoldableWithKey1 (IdentityT * m) # | |
| FoldableWithKey1 (Tagged * a) # | |
| (FoldableWithKey1 f, FoldableWithKey1 g) => FoldableWithKey1 ((:+:) * f g) # | |
| (FoldableWithKey1 f, FoldableWithKey1 g) => FoldableWithKey1 ((:*:) * f g) # | |
| (FoldableWithKey1 f, FoldableWithKey1 g) => FoldableWithKey1 (Product * f g) # | |
| (FoldableWithKey1 f, FoldableWithKey1 g) => FoldableWithKey1 (Sum * f g) # | |
| FoldableWithKey1 f => FoldableWithKey1 (M1 * i c f) # | |
| (FoldableWithKey1 f, FoldableWithKey1 m) => FoldableWithKey1 (Compose * * f 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 where #
Minimal complete definition
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
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 where #
Minimal complete definition
Methods
traverseWithKey1 :: Apply f => (Key t -> a -> f b) -> t a -> f (t b) #
Instances
| TraversableWithKey1 Par1 # | |
| TraversableWithKey1 NonEmpty # | |
| TraversableWithKey1 Identity # | |
| TraversableWithKey1 Tree # | |
| TraversableWithKey1 (V1 *) # | |
| TraversableWithKey1 ((,) k) # | |
| TraversableWithKey1 f => TraversableWithKey1 (Cofree f) # | |
| TraversableWithKey1 f => TraversableWithKey1 (Free f) # | |
| TraversableWithKey1 f => TraversableWithKey1 (Rec1 * f) # | |
| TraversableWithKey1 m => TraversableWithKey1 (IdentityT * m) # | |
| TraversableWithKey1 (Tagged * a) # | |
| (TraversableWithKey1 f, TraversableWithKey1 g) => TraversableWithKey1 ((:+:) * f g) # | |
| (TraversableWithKey1 f, TraversableWithKey1 g) => TraversableWithKey1 ((:*:) * f g) # | |
| (TraversableWithKey1 f, TraversableWithKey1 g) => TraversableWithKey1 (Product * f g) # | |
| (TraversableWithKey1 f, TraversableWithKey1 g) => TraversableWithKey1 (Sum * f g) # | |
| TraversableWithKey1 f => TraversableWithKey1 (M1 * i c f) # | |
| (TraversableWithKey1 f, TraversableWithKey1 m) => TraversableWithKey1 (Compose * * f m) # | |
foldMapWithKey1Default :: (TraversableWithKey1 t, Semigroup m) => (Key t -> a -> m) -> t a -> m #