semigroupoids-5.2.2: Semigroupoids: Category sans id

Copyright(C) 2011-2015 Edward Kmett
LicenseBSD-style (see the file LICENSE)
MaintainerEdward Kmett <ekmett@gmail.com>
Stabilityprovisional
Portabilityportable
Safe HaskellSafe
LanguageHaskell98

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 Source #

Minimal complete definition

duplicated | extended

Methods

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

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

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

extended f  = fmap f . duplicated
Instances
Extend [] Source # 
Instance details

Defined in Data.Functor.Extend

Methods

duplicated :: [a] -> [[a]] Source #

extended :: ([a] -> b) -> [a] -> [b] Source #

Extend Maybe Source # 
Instance details

Defined in Data.Functor.Extend

Methods

duplicated :: Maybe a -> Maybe (Maybe a) Source #

extended :: (Maybe a -> b) -> Maybe a -> Maybe b Source #

Extend Identity Source # 
Instance details

Defined in Data.Functor.Extend

Extend NonEmpty Source # 
Instance details

Defined in Data.Functor.Extend

Extend Tree Source # 
Instance details

Defined in Data.Functor.Extend

Methods

duplicated :: Tree a -> Tree (Tree a) Source #

extended :: (Tree a -> b) -> Tree a -> Tree b Source #

Extend Seq Source # 
Instance details

Defined in Data.Functor.Extend

Methods

duplicated :: Seq a -> Seq (Seq a) Source #

extended :: (Seq a -> b) -> Seq a -> Seq b Source #

Extend (Either a) Source # 
Instance details

Defined in Data.Functor.Extend

Methods

duplicated :: Either a a0 -> Either a (Either a a0) Source #

extended :: (Either a a0 -> b) -> Either a a0 -> Either a b Source #

Extend ((,) e) Source # 
Instance details

Defined in Data.Functor.Extend

Methods

duplicated :: (e, a) -> (e, (e, a)) Source #

extended :: ((e, a) -> b) -> (e, a) -> (e, b) Source #

Extend (Proxy :: * -> *) Source # 
Instance details

Defined in Data.Functor.Extend

Methods

duplicated :: Proxy a -> Proxy (Proxy a) Source #

extended :: (Proxy a -> b) -> Proxy a -> Proxy b Source #

Extend f => Extend (MaybeApply f) Source # 
Instance details

Defined in Data.Functor.Bind.Class

Methods

duplicated :: MaybeApply f a -> MaybeApply f (MaybeApply f a) Source #

extended :: (MaybeApply f a -> b) -> MaybeApply f a -> MaybeApply f b Source #

(Extend w, Semigroup m) => Extend (TracedT m w) Source # 
Instance details

Defined in Data.Functor.Extend

Methods

duplicated :: TracedT m w a -> TracedT m w (TracedT m w a) Source #

extended :: (TracedT m w a -> b) -> TracedT m w a -> TracedT m w b Source #

Extend w => Extend (StoreT s w) Source # 
Instance details

Defined in Data.Functor.Extend

Methods

duplicated :: StoreT s w a -> StoreT s w (StoreT s w a) Source #

extended :: (StoreT s w a -> b) -> StoreT s w a -> StoreT s w b Source #

Extend w => Extend (EnvT e w) Source # 
Instance details

Defined in Data.Functor.Extend

Methods

duplicated :: EnvT e w a -> EnvT e w (EnvT e w a) Source #

extended :: (EnvT e w a -> b) -> EnvT e w a -> EnvT e w b Source #

Extend w => Extend (IdentityT w) Source # 
Instance details

Defined in Data.Functor.Extend

Methods

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

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

Extend (Tagged a) Source # 
Instance details

Defined in Data.Functor.Extend

Methods

duplicated :: Tagged a a0 -> Tagged a (Tagged a a0) Source #

extended :: (Tagged a a0 -> b) -> Tagged a a0 -> Tagged a b Source #

(Extend f, Semigroup a) => Extend (Static f a) Source # 
Instance details

Defined in Data.Semigroupoid.Static

Methods

duplicated :: Static f a a0 -> Static f a (Static f a a0) Source #

extended :: (Static f a a0 -> b) -> Static f a a0 -> Static f a b Source #

Semigroup m => Extend ((->) m :: * -> *) Source # 
Instance details

Defined in Data.Functor.Extend

Methods

duplicated :: (m -> a) -> m -> m -> a Source #

extended :: ((m -> a) -> b) -> (m -> a) -> m -> b Source #

(Extend f, Extend g) => Extend (Sum f g) Source # 
Instance details

Defined in Data.Functor.Extend

Methods

duplicated :: Sum f g a -> Sum f g (Sum f g a) Source #

extended :: (Sum f g a -> b) -> Sum f g a -> Sum f g b Source #