semigroupoids-5.3.2: Semigroupoids: Category sans id

Data.Functor.Extend

Contents

Description

Synopsis

# Extendable Functors

There are two ways to define an Extend instance:

I. Provide definitions for extended satisfying this law:

extended f . extended g = extended (f . extended g)

II. Alternately, you may choose to provide definitions for duplicated satisfying this law:

duplicated . duplicated = fmap duplicated . duplicated

You may of course, choose to define both duplicated and extended. In that case you must also satisfy these laws:

extended f = fmap f . duplicated
duplicated = extended id

These are the default definitions of extended and duplicated.

class Functor w => Extend w where #

Minimal complete definition

Methods

duplicated :: w a -> w (w a) #

duplicated = extended id
fmap (fmap f) . duplicated = duplicated . fmap f

extended :: (w a -> b) -> w a -> w b #

extended f  = fmap f . duplicated
Instances
 Extend [] # Instance detailsDefined in Data.Functor.Extend Methodsduplicated :: [a] -> [[a]] #extended :: ([a] -> b) -> [a] -> [b] # # Instance detailsDefined in Data.Functor.Extend Methodsduplicated :: Maybe a -> Maybe (Maybe a) #extended :: (Maybe a -> b) -> Maybe a -> Maybe b # # Instance detailsDefined in Data.Functor.Extend Methodsduplicated :: Par1 a -> Par1 (Par1 a) #extended :: (Par1 a -> b) -> Par1 a -> Par1 b # # Instance detailsDefined in Data.Functor.Extend Methodsduplicated :: Min a -> Min (Min a) #extended :: (Min a -> b) -> Min a -> Min b # # Instance detailsDefined in Data.Functor.Extend Methodsduplicated :: Max a -> Max (Max a) #extended :: (Max a -> b) -> Max a -> Max b # # Instance detailsDefined in Data.Functor.Extend Methodsduplicated :: First a -> First (First a) #extended :: (First a -> b) -> First a -> First b # # Instance detailsDefined in Data.Functor.Extend Methodsduplicated :: Last a -> Last (Last a) #extended :: (Last a -> b) -> Last a -> Last b # # Instance detailsDefined in Data.Functor.Extend Methodsduplicated :: Identity a -> Identity (Identity a) #extended :: (Identity a -> b) -> Identity a -> Identity b # # Instance detailsDefined in Data.Functor.Extend Methodsduplicated :: Dual a -> Dual (Dual a) #extended :: (Dual a -> b) -> Dual a -> Dual b # # Instance detailsDefined in Data.Functor.Extend Methodsduplicated :: Sum a -> Sum (Sum a) #extended :: (Sum a -> b) -> Sum a -> Sum b # # Instance detailsDefined in Data.Functor.Extend Methodsduplicated :: Product a -> Product (Product a) #extended :: (Product a -> b) -> Product a -> Product b # # Instance detailsDefined in Data.Functor.Extend Methodsduplicated :: NonEmpty a -> NonEmpty (NonEmpty a) #extended :: (NonEmpty a -> b) -> NonEmpty a -> NonEmpty b # # Instance detailsDefined in Data.Functor.Extend Methodsduplicated :: Tree a -> Tree (Tree a) #extended :: (Tree a -> b) -> Tree a -> Tree b # # Instance detailsDefined in Data.Functor.Extend Methodsduplicated :: Seq a -> Seq (Seq a) #extended :: (Seq a -> b) -> Seq a -> Seq b # Extend (Either a) # Instance detailsDefined in Data.Functor.Extend Methodsduplicated :: Either a a0 -> Either a (Either a a0) #extended :: (Either a a0 -> b) -> Either a a0 -> Either a b # Extend (V1 :: Type -> Type) # Instance detailsDefined in Data.Functor.Extend Methodsduplicated :: V1 a -> V1 (V1 a) #extended :: (V1 a -> b) -> V1 a -> V1 b # Extend (U1 :: Type -> Type) # Instance detailsDefined in Data.Functor.Extend Methodsduplicated :: U1 a -> U1 (U1 a) #extended :: (U1 a -> b) -> U1 a -> U1 b # Extend ((,) e) # Instance detailsDefined in Data.Functor.Extend Methodsduplicated :: (e, a) -> (e, (e, a)) #extended :: ((e, a) -> b) -> (e, a) -> (e, b) # Extend (Proxy :: Type -> Type) # Instance detailsDefined in Data.Functor.Extend Methodsduplicated :: Proxy a -> Proxy (Proxy a) #extended :: (Proxy a -> b) -> Proxy a -> Proxy b # Extend f => Extend (MaybeApply f) # Instance detailsDefined in Data.Functor.Bind.Class Methodsduplicated :: MaybeApply f a -> MaybeApply f (MaybeApply f a) #extended :: (MaybeApply f a -> b) -> MaybeApply f a -> MaybeApply f b # Extend f => Extend (Rec1 f) # Instance detailsDefined in Data.Functor.Extend Methodsduplicated :: Rec1 f a -> Rec1 f (Rec1 f a) #extended :: (Rec1 f a -> b) -> Rec1 f a -> Rec1 f b # Extend f => Extend (Alt f) # Instance detailsDefined in Data.Functor.Extend Methodsduplicated :: Alt f a -> Alt f (Alt f a) #extended :: (Alt f a -> b) -> Alt f a -> Alt f b # (Extend w, Semigroup m) => Extend (TracedT m w) # Instance detailsDefined in Data.Functor.Extend Methodsduplicated :: TracedT m w a -> TracedT m w (TracedT m w a) #extended :: (TracedT m w a -> b) -> TracedT m w a -> TracedT m w b # Extend w => Extend (StoreT s w) # Instance detailsDefined in Data.Functor.Extend Methodsduplicated :: StoreT s w a -> StoreT s w (StoreT s w a) #extended :: (StoreT s w a -> b) -> StoreT s w a -> StoreT s w b # Extend w => Extend (EnvT e w) # Instance detailsDefined in Data.Functor.Extend Methodsduplicated :: EnvT e w a -> EnvT e w (EnvT e w a) #extended :: (EnvT e w a -> b) -> EnvT e w a -> EnvT e w b # Extend w => Extend (IdentityT w) # Instance detailsDefined in Data.Functor.Extend Methodsduplicated :: IdentityT w a -> IdentityT w (IdentityT w a) #extended :: (IdentityT w a -> b) -> IdentityT w a -> IdentityT w b # Extend (Tagged a) # Instance detailsDefined in Data.Functor.Extend Methodsduplicated :: Tagged a a0 -> Tagged a (Tagged a a0) #extended :: (Tagged a a0 -> b) -> Tagged a a0 -> Tagged a b # (Extend f, Semigroup a) => Extend (Static f a) # Instance detailsDefined in Data.Semigroupoid.Static Methodsduplicated :: Static f a a0 -> Static f a (Static f a a0) #extended :: (Static f a a0 -> b) -> Static f a a0 -> Static f a b # Semigroup m => Extend ((->) m :: Type -> Type) # Instance detailsDefined in Data.Functor.Extend Methodsduplicated :: (m -> a) -> m -> (m -> a) #extended :: ((m -> a) -> b) -> (m -> a) -> m -> b # (Extend f, Extend g) => Extend (f :+: g) # Instance detailsDefined in Data.Functor.Extend Methodsduplicated :: (f :+: g) a -> (f :+: g) ((f :+: g) a) #extended :: ((f :+: g) a -> b) -> (f :+: g) a -> (f :+: g) b # (Extend f, Extend g) => Extend (Sum f g) # Instance detailsDefined in Data.Functor.Extend Methodsduplicated :: Sum f g a -> Sum f g (Sum f g a) #extended :: (Sum f g a -> b) -> Sum f g a -> Sum f g b # Extend f => Extend (M1 i t f) # Instance detailsDefined in Data.Functor.Extend Methodsduplicated :: M1 i t f a -> M1 i t f (M1 i t f a) #extended :: (M1 i t f a -> b) -> M1 i t f a -> M1 i t f b #