compdata-0.12: Compositional Data Types

Copyright (c) 2014 Patrick Bahr BSD3 Patrick Bahr experimental non-portable (GHC Extensions) None Haskell98

Data.Comp.Mapping

Description

This module provides functionality to construct mappings from positions in a functorial value.

Synopsis

# Documentation

data Numbered a Source #

This type is used for numbering components of a functorial value.

Constructors

 Numbered Int a
Instances
 Mapping (NumMap k) (Numbered k) Source # Instance detailsDefined in Data.Comp.Mapping Methods(&) :: NumMap k v -> NumMap k v -> NumMap k v Source #(|->) :: Numbered k -> v -> NumMap k v Source #empty :: NumMap k v Source #prodMapWith :: (v1 -> v2 -> v) -> v1 -> v2 -> NumMap k v1 -> NumMap k v2 -> NumMap k v Source #findWithDefault :: a -> Numbered k -> NumMap k a -> a Source #

number :: Traversable f => f a -> f (Numbered a) Source #

This function numbers the components of the given functorial value with consecutive integers starting at 0.

class (Functor t, Foldable t) => Traversable (t :: * -> *) #

Functors representing data structures that can be traversed from left to right.

A definition of traverse must satisfy the following laws:

naturality
t . traverse f = traverse (t . f) for every applicative transformation t
identity
traverse Identity = Identity
composition
traverse (Compose . fmap g . f) = Compose . fmap (traverse g) . traverse f

A definition of sequenceA must satisfy the following laws:

naturality
t . sequenceA = sequenceA . fmap t for every applicative transformation t
identity
sequenceA . fmap Identity = Identity
composition
sequenceA . fmap Compose = Compose . fmap sequenceA . sequenceA

where an applicative transformation is a function

t :: (Applicative f, Applicative g) => f a -> g a

preserving the Applicative operations, i.e.

• t (pure x) = pure x
• t (x <*> y) = t x <*> t y

and the identity functor Identity and composition of functors Compose are defined as

  newtype Identity a = Identity a

instance Functor Identity where
fmap f (Identity x) = Identity (f x)

instance Applicative Identity where
pure x = Identity x
Identity f <*> Identity x = Identity (f x)

newtype Compose f g a = Compose (f (g a))

instance (Functor f, Functor g) => Functor (Compose f g) where
fmap f (Compose x) = Compose (fmap (fmap f) x)

instance (Applicative f, Applicative g) => Applicative (Compose f g) where
pure x = Compose (pure (pure x))
Compose f <*> Compose x = Compose ((<*>) <$> f <*> x) (The naturality law is implied by parametricity.) Instances are similar to Functor, e.g. given a data type data Tree a = Empty | Leaf a | Node (Tree a) a (Tree a) a suitable instance would be instance Traversable Tree where traverse f Empty = pure Empty traverse f (Leaf x) = Leaf <$> f x
traverse f (Node l k r) = Node <$> traverse f l <*> f k <*> traverse f r This is suitable even for abstract types, as the laws for <*> imply a form of associativity. The superclass instances should satisfy the following: • In the Functor instance, fmap should be equivalent to traversal with the identity applicative functor (fmapDefault). • In the Foldable instance, foldMap should be equivalent to traversal with a constant applicative functor (foldMapDefault). Minimal complete definition Instances  Since: base-2.1 Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> [a] -> f [b] #sequenceA :: Applicative f => [f a] -> f [a] #mapM :: Monad m => (a -> m b) -> [a] -> m [b] #sequence :: Monad m => [m a] -> m [a] # Since: base-2.1 Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> Maybe a -> f (Maybe b) #sequenceA :: Applicative f => Maybe (f a) -> f (Maybe a) #mapM :: Monad m => (a -> m b) -> Maybe a -> m (Maybe b) #sequence :: Monad m => Maybe (m a) -> m (Maybe a) # Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> Par1 a -> f (Par1 b) #sequenceA :: Applicative f => Par1 (f a) -> f (Par1 a) #mapM :: Monad m => (a -> m b) -> Par1 a -> m (Par1 b) #sequence :: Monad m => Par1 (m a) -> m (Par1 a) # Instance detailsDefined in Data.Complex Methodstraverse :: Applicative f => (a -> f b) -> Complex a -> f (Complex b) #sequenceA :: Applicative f => Complex (f a) -> f (Complex a) #mapM :: Monad m => (a -> m b) -> Complex a -> m (Complex b) #sequence :: Monad m => Complex (m a) -> m (Complex a) # Since: base-4.9.0.0 Instance detailsDefined in Data.Semigroup Methodstraverse :: Applicative f => (a -> f b) -> Min a -> f (Min b) #sequenceA :: Applicative f => Min (f a) -> f (Min a) #mapM :: Monad m => (a -> m b) -> Min a -> m (Min b) #sequence :: Monad m => Min (m a) -> m (Min a) # Since: base-4.9.0.0 Instance detailsDefined in Data.Semigroup Methodstraverse :: Applicative f => (a -> f b) -> Max a -> f (Max b) #sequenceA :: Applicative f => Max (f a) -> f (Max a) #mapM :: Monad m => (a -> m b) -> Max a -> m (Max b) #sequence :: Monad m => Max (m a) -> m (Max a) # Since: base-4.9.0.0 Instance detailsDefined in Data.Semigroup Methodstraverse :: Applicative f => (a -> f b) -> First a -> f (First b) #sequenceA :: Applicative f => First (f a) -> f (First a) #mapM :: Monad m => (a -> m b) -> First a -> m (First b) #sequence :: Monad m => First (m a) -> m (First a) # Since: base-4.9.0.0 Instance detailsDefined in Data.Semigroup Methodstraverse :: Applicative f => (a -> f b) -> Last a -> f (Last b) #sequenceA :: Applicative f => Last (f a) -> f (Last a) #mapM :: Monad m => (a -> m b) -> Last a -> m (Last b) #sequence :: Monad m => Last (m a) -> m (Last a) # Since: base-4.9.0.0 Instance detailsDefined in Data.Semigroup Methodstraverse :: Applicative f => (a -> f b) -> Option a -> f (Option b) #sequenceA :: Applicative f => Option (f a) -> f (Option a) #mapM :: Monad m => (a -> m b) -> Option a -> m (Option b) #sequence :: Monad m => Option (m a) -> m (Option a) # Since: base-4.9.0.0 Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> ZipList a -> f (ZipList b) #sequenceA :: Applicative f => ZipList (f a) -> f (ZipList a) #mapM :: Monad m => (a -> m b) -> ZipList a -> m (ZipList b) #sequence :: Monad m => ZipList (m a) -> m (ZipList a) # Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> Identity a -> f (Identity b) #sequenceA :: Applicative f => Identity (f a) -> f (Identity a) #mapM :: Monad m => (a -> m b) -> Identity a -> m (Identity b) #sequence :: Monad m => Identity (m a) -> m (Identity a) # Since: base-4.8.0.0 Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> First a -> f (First b) #sequenceA :: Applicative f => First (f a) -> f (First a) #mapM :: Monad m => (a -> m b) -> First a -> m (First b) #sequence :: Monad m => First (m a) -> m (First a) # Since: base-4.8.0.0 Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> Last a -> f (Last b) #sequenceA :: Applicative f => Last (f a) -> f (Last a) #mapM :: Monad m => (a -> m b) -> Last a -> m (Last b) #sequence :: Monad m => Last (m a) -> m (Last a) # Since: base-4.8.0.0 Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> Dual a -> f (Dual b) #sequenceA :: Applicative f => Dual (f a) -> f (Dual a) #mapM :: Monad m => (a -> m b) -> Dual a -> m (Dual b) #sequence :: Monad m => Dual (m a) -> m (Dual a) # Since: base-4.8.0.0 Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> Sum a -> f (Sum b) #sequenceA :: Applicative f => Sum (f a) -> f (Sum a) #mapM :: Monad m => (a -> m b) -> Sum a -> m (Sum b) #sequence :: Monad m => Sum (m a) -> m (Sum a) # Since: base-4.8.0.0 Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> Product a -> f (Product b) #sequenceA :: Applicative f => Product (f a) -> f (Product a) #mapM :: Monad m => (a -> m b) -> Product a -> m (Product b) #sequence :: Monad m => Product (m a) -> m (Product a) # Since: base-4.9.0.0 Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> NonEmpty a -> f (NonEmpty b) #sequenceA :: Applicative f => NonEmpty (f a) -> f (NonEmpty a) #mapM :: Monad m => (a -> m b) -> NonEmpty a -> m (NonEmpty b) #sequence :: Monad m => NonEmpty (m a) -> m (NonEmpty a) # Instance detailsDefined in Data.IntMap.Internal Methodstraverse :: Applicative f => (a -> f b) -> IntMap a -> f (IntMap b) #sequenceA :: Applicative f => IntMap (f a) -> f (IntMap a) #mapM :: Monad m => (a -> m b) -> IntMap a -> m (IntMap b) #sequence :: Monad m => IntMap (m a) -> m (IntMap a) # Instance detailsDefined in Data.Tree Methodstraverse :: Applicative f => (a -> f b) -> Tree a -> f (Tree b) #sequenceA :: Applicative f => Tree (f a) -> f (Tree a) #mapM :: Monad m => (a -> m b) -> Tree a -> m (Tree b) #sequence :: Monad m => Tree (m a) -> m (Tree a) # Instance detailsDefined in Data.Sequence.Internal Methodstraverse :: Applicative f => (a -> f b) -> Seq a -> f (Seq b) #sequenceA :: Applicative f => Seq (f a) -> f (Seq a) #mapM :: Monad m => (a -> m b) -> Seq a -> m (Seq b) #sequence :: Monad m => Seq (m a) -> m (Seq a) # Instance detailsDefined in Data.Sequence.Internal Methodstraverse :: Applicative f => (a -> f b) -> FingerTree a -> f (FingerTree b) #sequenceA :: Applicative f => FingerTree (f a) -> f (FingerTree a) #mapM :: Monad m => (a -> m b) -> FingerTree a -> m (FingerTree b) #sequence :: Monad m => FingerTree (m a) -> m (FingerTree a) # Instance detailsDefined in Data.Sequence.Internal Methodstraverse :: Applicative f => (a -> f b) -> Digit a -> f (Digit b) #sequenceA :: Applicative f => Digit (f a) -> f (Digit a) #mapM :: Monad m => (a -> m b) -> Digit a -> m (Digit b) #sequence :: Monad m => Digit (m a) -> m (Digit a) # Instance detailsDefined in Data.Sequence.Internal Methodstraverse :: Applicative f => (a -> f b) -> Node a -> f (Node b) #sequenceA :: Applicative f => Node (f a) -> f (Node a) #mapM :: Monad m => (a -> m b) -> Node a -> m (Node b) #sequence :: Monad m => Node (m a) -> m (Node a) # Instance detailsDefined in Data.Sequence.Internal Methodstraverse :: Applicative f => (a -> f b) -> Elem a -> f (Elem b) #sequenceA :: Applicative f => Elem (f a) -> f (Elem a) #mapM :: Monad m => (a -> m b) -> Elem a -> m (Elem b) #sequence :: Monad m => Elem (m a) -> m (Elem a) # Instance detailsDefined in Data.Sequence.Internal Methodstraverse :: Applicative f => (a -> f b) -> ViewL a -> f (ViewL b) #sequenceA :: Applicative f => ViewL (f a) -> f (ViewL a) #mapM :: Monad m => (a -> m b) -> ViewL a -> m (ViewL b) #sequence :: Monad m => ViewL (m a) -> m (ViewL a) # Instance detailsDefined in Data.Sequence.Internal Methodstraverse :: Applicative f => (a -> f b) -> ViewR a -> f (ViewR b) #sequenceA :: Applicative f => ViewR (f a) -> f (ViewR a) #mapM :: Monad m => (a -> m b) -> ViewR a -> m (ViewR b) #sequence :: Monad m => ViewR (m a) -> m (ViewR a) # # Instance detailsDefined in Data.Comp.Multi.HFunctor Methodstraverse :: Applicative f => (a -> f b) -> I a -> f (I b) #sequenceA :: Applicative f => I (f a) -> f (I a) #mapM :: Monad m => (a -> m b) -> I a -> m (I b) #sequence :: Monad m => I (m a) -> m (I a) # Since: base-4.7.0.0 Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a0 -> f b) -> Either a a0 -> f (Either a b) #sequenceA :: Applicative f => Either a (f a0) -> f (Either a a0) #mapM :: Monad m => (a0 -> m b) -> Either a a0 -> m (Either a b) #sequence :: Monad m => Either a (m a0) -> m (Either a a0) # Traversable (V1 :: * -> *) Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> V1 a -> f (V1 b) #sequenceA :: Applicative f => V1 (f a) -> f (V1 a) #mapM :: Monad m => (a -> m b) -> V1 a -> m (V1 b) #sequence :: Monad m => V1 (m a) -> m (V1 a) # Traversable (U1 :: * -> *) Since: base-4.9.0.0 Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> U1 a -> f (U1 b) #sequenceA :: Applicative f => U1 (f a) -> f (U1 a) #mapM :: Monad m => (a -> m b) -> U1 a -> m (U1 b) #sequence :: Monad m => U1 (m a) -> m (U1 a) # Since: base-4.7.0.0 Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a0 -> f b) -> (a, a0) -> f (a, b) #sequenceA :: Applicative f => (a, f a0) -> f (a, a0) #mapM :: Monad m => (a0 -> m b) -> (a, a0) -> m (a, b) #sequence :: Monad m => (a, m a0) -> m (a, a0) # Ix i => Traversable (Array i) Since: base-2.1 Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> Array i a -> f (Array i b) #sequenceA :: Applicative f => Array i (f a) -> f (Array i a) #mapM :: Monad m => (a -> m b) -> Array i a -> m (Array i b) #sequence :: Monad m => Array i (m a) -> m (Array i a) # Since: base-4.9.0.0 Instance detailsDefined in Data.Semigroup Methodstraverse :: Applicative f => (a0 -> f b) -> Arg a a0 -> f (Arg a b) #sequenceA :: Applicative f => Arg a (f a0) -> f (Arg a a0) #mapM :: Monad m => (a0 -> m b) -> Arg a a0 -> m (Arg a b) #sequence :: Monad m => Arg a (m a0) -> m (Arg a a0) # Traversable (Proxy :: * -> *) Since: base-4.7.0.0 Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> Proxy a -> f (Proxy b) #sequenceA :: Applicative f => Proxy (f a) -> f (Proxy a) #mapM :: Monad m => (a -> m b) -> Proxy a -> m (Proxy b) #sequence :: Monad m => Proxy (m a) -> m (Proxy a) # Instance detailsDefined in Data.Map.Internal Methodstraverse :: Applicative f => (a -> f b) -> Map k a -> f (Map k b) #sequenceA :: Applicative f => Map k (f a) -> f (Map k a) #mapM :: Monad m => (a -> m b) -> Map k a -> m (Map k b) #sequence :: Monad m => Map k (m a) -> m (Map k a) # Traversable f => Traversable (ListT f) Instance detailsDefined in Control.Monad.Trans.List Methodstraverse :: Applicative f0 => (a -> f0 b) -> ListT f a -> f0 (ListT f b) #sequenceA :: Applicative f0 => ListT f (f0 a) -> f0 (ListT f a) #mapM :: Monad m => (a -> m b) -> ListT f a -> m (ListT f b) #sequence :: Monad m => ListT f (m a) -> m (ListT f a) # Traversable f => Traversable (MaybeT f) Instance detailsDefined in Control.Monad.Trans.Maybe Methodstraverse :: Applicative f0 => (a -> f0 b) -> MaybeT f a -> f0 (MaybeT f b) #sequenceA :: Applicative f0 => MaybeT f (f0 a) -> f0 (MaybeT f a) #mapM :: Monad m => (a -> m b) -> MaybeT f a -> m (MaybeT f b) #sequence :: Monad m => MaybeT f (m a) -> m (MaybeT f a) # # Instance detailsDefined in Data.Comp.Mapping Methodstraverse :: Applicative f => (a -> f b) -> NumMap k a -> f (NumMap k b) #sequenceA :: Applicative f => NumMap k (f a) -> f (NumMap k a) #mapM :: Monad m => (a -> m b) -> NumMap k a -> m (NumMap k b) #sequence :: Monad m => NumMap k (m a) -> m (NumMap k a) # Traversable (K a) # Instance detailsDefined in Data.Comp.Multi.HFunctor Methodstraverse :: Applicative f => (a0 -> f b) -> K a a0 -> f (K a b) #sequenceA :: Applicative f => K a (f a0) -> f (K a a0) #mapM :: Monad m => (a0 -> m b) -> K a a0 -> m (K a b) #sequence :: Monad m => K a (m a0) -> m (K a a0) # Traversable f => Traversable (Rec1 f) Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f0 => (a -> f0 b) -> Rec1 f a -> f0 (Rec1 f b) #sequenceA :: Applicative f0 => Rec1 f (f0 a) -> f0 (Rec1 f a) #mapM :: Monad m => (a -> m b) -> Rec1 f a -> m (Rec1 f b) #sequence :: Monad m => Rec1 f (m a) -> m (Rec1 f a) # Traversable (URec Char :: * -> *) Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> URec Char a -> f (URec Char b) #sequenceA :: Applicative f => URec Char (f a) -> f (URec Char a) #mapM :: Monad m => (a -> m b) -> URec Char a -> m (URec Char b) #sequence :: Monad m => URec Char (m a) -> m (URec Char a) # Traversable (URec Double :: * -> *) Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> URec Double a -> f (URec Double b) #sequenceA :: Applicative f => URec Double (f a) -> f (URec Double a) #mapM :: Monad m => (a -> m b) -> URec Double a -> m (URec Double b) #sequence :: Monad m => URec Double (m a) -> m (URec Double a) # Traversable (URec Float :: * -> *) Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> URec Float a -> f (URec Float b) #sequenceA :: Applicative f => URec Float (f a) -> f (URec Float a) #mapM :: Monad m => (a -> m b) -> URec Float a -> m (URec Float b) #sequence :: Monad m => URec Float (m a) -> m (URec Float a) # Traversable (URec Int :: * -> *) Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> URec Int a -> f (URec Int b) #sequenceA :: Applicative f => URec Int (f a) -> f (URec Int a) #mapM :: Monad m => (a -> m b) -> URec Int a -> m (URec Int b) #sequence :: Monad m => URec Int (m a) -> m (URec Int a) # Traversable (URec Word :: * -> *) Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> URec Word a -> f (URec Word b) #sequenceA :: Applicative f => URec Word (f a) -> f (URec Word a) #mapM :: Monad m => (a -> m b) -> URec Word a -> m (URec Word b) #sequence :: Monad m => URec Word (m a) -> m (URec Word a) # Traversable (URec (Ptr ()) :: * -> *) Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> URec (Ptr ()) a -> f (URec (Ptr ()) b) #sequenceA :: Applicative f => URec (Ptr ()) (f a) -> f (URec (Ptr ()) a) #mapM :: Monad m => (a -> m b) -> URec (Ptr ()) a -> m (URec (Ptr ()) b) #sequence :: Monad m => URec (Ptr ()) (m a) -> m (URec (Ptr ()) a) # Traversable (Const m :: * -> *) Since: base-4.7.0.0 Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> Const m a -> f (Const m b) #sequenceA :: Applicative f => Const m (f a) -> f (Const m a) #mapM :: Monad m0 => (a -> m0 b) -> Const m a -> m0 (Const m b) #sequence :: Monad m0 => Const m (m0 a) -> m0 (Const m a) # Instance detailsDefined in Control.Monad.Trans.Identity Methodstraverse :: Applicative f0 => (a -> f0 b) -> IdentityT f a -> f0 (IdentityT f b) #sequenceA :: Applicative f0 => IdentityT f (f0 a) -> f0 (IdentityT f a) #mapM :: Monad m => (a -> m b) -> IdentityT f a -> m (IdentityT f b) #sequence :: Monad m => IdentityT f (m a) -> m (IdentityT f a) # Traversable f => Traversable (ErrorT e f) Instance detailsDefined in Control.Monad.Trans.Error Methodstraverse :: Applicative f0 => (a -> f0 b) -> ErrorT e f a -> f0 (ErrorT e f b) #sequenceA :: Applicative f0 => ErrorT e f (f0 a) -> f0 (ErrorT e f a) #mapM :: Monad m => (a -> m b) -> ErrorT e f a -> m (ErrorT e f b) #sequence :: Monad m => ErrorT e f (m a) -> m (ErrorT e f a) # Traversable f => Traversable (ExceptT e f) Instance detailsDefined in Control.Monad.Trans.Except Methodstraverse :: Applicative f0 => (a -> f0 b) -> ExceptT e f a -> f0 (ExceptT e f b) #sequenceA :: Applicative f0 => ExceptT e f (f0 a) -> f0 (ExceptT e f a) #mapM :: Monad m => (a -> m b) -> ExceptT e f a -> m (ExceptT e f b) #sequence :: Monad m => ExceptT e f (m a) -> m (ExceptT e f a) # Traversable f => Traversable (WriterT w f) Instance detailsDefined in Control.Monad.Trans.Writer.Lazy Methodstraverse :: Applicative f0 => (a -> f0 b) -> WriterT w f a -> f0 (WriterT w f b) #sequenceA :: Applicative f0 => WriterT w f (f0 a) -> f0 (WriterT w f a) #mapM :: Monad m => (a -> m b) -> WriterT w f a -> m (WriterT w f b) #sequence :: Monad m => WriterT w f (m a) -> m (WriterT w f a) # Traversable f => Traversable (WriterT w f) Instance detailsDefined in Control.Monad.Trans.Writer.Strict Methodstraverse :: Applicative f0 => (a -> f0 b) -> WriterT w f a -> f0 (WriterT w f b) #sequenceA :: Applicative f0 => WriterT w f (f0 a) -> f0 (WriterT w f a) #mapM :: Monad m => (a -> m b) -> WriterT w f a -> m (WriterT w f b) #sequence :: Monad m => WriterT w f (m a) -> m (WriterT w f a) # Traversable (Constant a :: * -> *) Instance detailsDefined in Data.Functor.Constant Methodstraverse :: Applicative f => (a0 -> f b) -> Constant a a0 -> f (Constant a b) #sequenceA :: Applicative f => Constant a (f a0) -> f (Constant a a0) #mapM :: Monad m => (a0 -> m b) -> Constant a a0 -> m (Constant a b) #sequence :: Monad m => Constant a (m a0) -> m (Constant a a0) # Traversable f => Traversable (Cxt h f) # Instance detailsDefined in Data.Comp.Term Methodstraverse :: Applicative f0 => (a -> f0 b) -> Cxt h f a -> f0 (Cxt h f b) #sequenceA :: Applicative f0 => Cxt h f (f0 a) -> f0 (Cxt h f a) #mapM :: Monad m => (a -> m b) -> Cxt h f a -> m (Cxt h f b) #sequence :: Monad m => Cxt h f (m a) -> m (Cxt h f a) # Traversable (K1 i c :: * -> *) Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> K1 i c a -> f (K1 i c b) #sequenceA :: Applicative f => K1 i c (f a) -> f (K1 i c a) #mapM :: Monad m => (a -> m b) -> K1 i c a -> m (K1 i c b) #sequence :: Monad m => K1 i c (m a) -> m (K1 i c a) # (Traversable f, Traversable g) => Traversable (f :+: g) Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f0 => (a -> f0 b) -> (f :+: g) a -> f0 ((f :+: g) b) #sequenceA :: Applicative f0 => (f :+: g) (f0 a) -> f0 ((f :+: g) a) #mapM :: Monad m => (a -> m b) -> (f :+: g) a -> m ((f :+: g) b) #sequence :: Monad m => (f :+: g) (m a) -> m ((f :+: g) a) # (Traversable f, Traversable g) => Traversable (f :*: g) Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f0 => (a -> f0 b) -> (f :*: g) a -> f0 ((f :*: g) b) #sequenceA :: Applicative f0 => (f :*: g) (f0 a) -> f0 ((f :*: g) a) #mapM :: Monad m => (a -> m b) -> (f :*: g) a -> m ((f :*: g) b) #sequence :: Monad m => (f :*: g) (m a) -> m ((f :*: g) a) # (Traversable f, Traversable g) => Traversable (Product f g) Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Product Methodstraverse :: Applicative f0 => (a -> f0 b) -> Product f g a -> f0 (Product f g b) #sequenceA :: Applicative f0 => Product f g (f0 a) -> f0 (Product f g a) #mapM :: Monad m => (a -> m b) -> Product f g a -> m (Product f g b) #sequence :: Monad m => Product f g (m a) -> m (Product f g a) # (Traversable f, Traversable g) => Traversable (Sum f g) Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Sum Methodstraverse :: Applicative f0 => (a -> f0 b) -> Sum f g a -> f0 (Sum f g b) #sequenceA :: Applicative f0 => Sum f g (f0 a) -> f0 (Sum f g a) #mapM :: Monad m => (a -> m b) -> Sum f g a -> m (Sum f g b) #sequence :: Monad m => Sum f g (m a) -> m (Sum f g a) # Traversable f => Traversable (f :&: a) # Instance detailsDefined in Data.Comp.Ops Methodstraverse :: Applicative f0 => (a0 -> f0 b) -> (f :&: a) a0 -> f0 ((f :&: a) b) #sequenceA :: Applicative f0 => (f :&: a) (f0 a0) -> f0 ((f :&: a) a0) #mapM :: Monad m => (a0 -> m b) -> (f :&: a) a0 -> m ((f :&: a) b) #sequence :: Monad m => (f :&: a) (m a0) -> m ((f :&: a) a0) # (Traversable f, Traversable g) => Traversable (f :*: g) # Instance detailsDefined in Data.Comp.Ops Methodstraverse :: Applicative f0 => (a -> f0 b) -> (f :*: g) a -> f0 ((f :*: g) b) #sequenceA :: Applicative f0 => (f :*: g) (f0 a) -> f0 ((f :*: g) a) #mapM :: Monad m => (a -> m b) -> (f :*: g) a -> m ((f :*: g) b) #sequence :: Monad m => (f :*: g) (m a) -> m ((f :*: g) a) # (Traversable f, Traversable g) => Traversable (f :+: g) # Instance detailsDefined in Data.Comp.Ops Methodstraverse :: Applicative f0 => (a -> f0 b) -> (f :+: g) a -> f0 ((f :+: g) b) #sequenceA :: Applicative f0 => (f :+: g) (f0 a) -> f0 ((f :+: g) a) #mapM :: Monad m => (a -> m b) -> (f :+: g) a -> m ((f :+: g) b) #sequence :: Monad m => (f :+: g) (m a) -> m ((f :+: g) a) # Traversable f => Traversable (M1 i c f) Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f0 => (a -> f0 b) -> M1 i c f a -> f0 (M1 i c f b) #sequenceA :: Applicative f0 => M1 i c f (f0 a) -> f0 (M1 i c f a) #mapM :: Monad m => (a -> m b) -> M1 i c f a -> m (M1 i c f b) #sequence :: Monad m => M1 i c f (m a) -> m (M1 i c f a) # (Traversable f, Traversable g) => Traversable (f :.: g) Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f0 => (a -> f0 b) -> (f :.: g) a -> f0 ((f :.: g) b) #sequenceA :: Applicative f0 => (f :.: g) (f0 a) -> f0 ((f :.: g) a) #mapM :: Monad m => (a -> m b) -> (f :.: g) a -> m ((f :.: g) b) #sequence :: Monad m => (f :.: g) (m a) -> m ((f :.: g) a) # (Traversable f, Traversable g) => Traversable (Compose f g) Since: base-4.9.0.0 Instance detailsDefined in Data.Functor.Compose Methodstraverse :: Applicative f0 => (a -> f0 b) -> Compose f g a -> f0 (Compose f g b) #sequenceA :: Applicative f0 => Compose f g (f0 a) -> f0 (Compose f g a) #mapM :: Monad m => (a -> m b) -> Compose f g a -> m (Compose f g b) #sequence :: Monad m => Compose f g (m a) -> m (Compose f g a) # class Functor m => Mapping m k | m -> k where Source # Minimal complete definition Methods (&) :: m v -> m v -> m v infixr 0 Source # left-biased union of two mappings. (|->) :: k -> v -> m v infix 1 Source # This operator constructs a singleton mapping. empty :: m v Source # This is the empty mapping. prodMapWith :: (v1 -> v2 -> v) -> v1 -> v2 -> m v1 -> m v2 -> m v Source # This function constructs the pointwise product of two maps each with a default value. findWithDefault :: a -> k -> m a -> a Source # Returns the value at the given key or returns the given default when the key is not an element of the map. Instances  Mapping (NumMap k) (Numbered k) Source # Instance detailsDefined in Data.Comp.Mapping Methods(&) :: NumMap k v -> NumMap k v -> NumMap k v Source #(|->) :: Numbered k -> v -> NumMap k v Source #empty :: NumMap k v Source #prodMapWith :: (v1 -> v2 -> v) -> v1 -> v2 -> NumMap k v1 -> NumMap k v2 -> NumMap k v Source #findWithDefault :: a -> Numbered k -> NumMap k a -> a Source # prodMap :: Mapping m k => v1 -> v2 -> m v1 -> m v2 -> m (v1, v2) Source # This function constructs the pointwise product of two maps each with a default value. lookupNumMap :: a -> Int -> NumMap t a -> a Source # data NumMap k v Source # Instances  Source # Instance detailsDefined in Data.Comp.Mapping Methodsfmap :: (a -> b) -> NumMap k a -> NumMap k b #(<$) :: a -> NumMap k b -> NumMap k a # Source # Instance detailsDefined in Data.Comp.Mapping Methodsfold :: Monoid m => NumMap k m -> m #foldMap :: Monoid m => (a -> m) -> NumMap k a -> m #foldr :: (a -> b -> b) -> b -> NumMap k a -> b #foldr' :: (a -> b -> b) -> b -> NumMap k a -> b #foldl :: (b -> a -> b) -> b -> NumMap k a -> b #foldl' :: (b -> a -> b) -> b -> NumMap k a -> b #foldr1 :: (a -> a -> a) -> NumMap k a -> a #foldl1 :: (a -> a -> a) -> NumMap k a -> a #toList :: NumMap k a -> [a] #null :: NumMap k a -> Bool #length :: NumMap k a -> Int #elem :: Eq a => a -> NumMap k a -> Bool #maximum :: Ord a => NumMap k a -> a #minimum :: Ord a => NumMap k a -> a #sum :: Num a => NumMap k a -> a #product :: Num a => NumMap k a -> a # Source # Instance detailsDefined in Data.Comp.Mapping Methodstraverse :: Applicative f => (a -> f b) -> NumMap k a -> f (NumMap k b) #sequenceA :: Applicative f => NumMap k (f a) -> f (NumMap k a) #mapM :: Monad m => (a -> m b) -> NumMap k a -> m (NumMap k b) #sequence :: Monad m => NumMap k (m a) -> m (NumMap k a) # Mapping (NumMap k) (Numbered k) Source # Instance detailsDefined in Data.Comp.Mapping Methods(&) :: NumMap k v -> NumMap k v -> NumMap k v Source #(|->) :: Numbered k -> v -> NumMap k v Source #empty :: NumMap k v Source #prodMapWith :: (v1 -> v2 -> v) -> v1 -> v2 -> NumMap k v1 -> NumMap k v2 -> NumMap k v Source #findWithDefault :: a -> Numbered k -> NumMap k a -> a Source #