semigroupoids-5.3.7: Semigroupoids: Category sans id
Copyright (C) 2011-2015 Edward Kmett
License BSD-style (see the file LICENSE)
Maintainer Edward Kmett <ekmett@gmail.com>
Stability provisional
Portability portable
Safe Haskell Trustworthy
Language Haskell2010

Data.Functor.Extend

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

Instances details
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

Extend Par1 Source #
Instance details

Defined in Data.Functor.Extend

Extend Min Source #
Instance details

Defined in Data.Functor.Extend

Extend Max Source #
Instance details

Defined in Data.Functor.Extend

Extend First Source #
Instance details

Defined in Data.Functor.Extend

Extend Last Source #
Instance details

Defined in Data.Functor.Extend

Extend Identity Source #
Instance details

Defined in Data.Functor.Extend

Extend Dual Source #
Instance details

Defined in Data.Functor.Extend

Extend Sum Source #
Instance details

Defined in Data.Functor.Extend

Extend Product 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

Extend Seq Source #
Instance details

Defined in Data.Functor.Extend

Extend ( Either a) Source #
Instance details

Defined in Data.Functor.Extend

Extend ( V1 :: Type -> Type ) Source #
Instance details

Defined in Data.Functor.Extend

Extend ( U1 :: Type -> Type ) Source #
Instance details

Defined in Data.Functor.Extend

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 :: Type -> Type ) Source #
Instance details

Defined in Data.Functor.Extend

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

Defined in Data.Functor.Bind.Class

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

Defined in Data.Functor.Extend

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

Defined in Data.Functor.Extend

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

Defined in Data.Functor.Extend

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

Defined in Data.Functor.Extend

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

Extend ( Tagged a) Source #
Instance details

Defined in Data.Functor.Extend

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

Defined in Data.Semigroupoid.Static

Semigroup m => Extend ((->) m :: Type -> Type ) 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 (f :+: g) Source #
Instance details

Defined in Data.Functor.Extend

Methods

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

extended :: ((f :+: g) a -> b) -> (f :+: g) a -> (f :+: g) 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 #

Extend f => Extend ( M1 i t f) Source #
Instance details

Defined in Data.Functor.Extend

Methods

duplicated :: M1 i t f a -> M1 i t f ( M1 i t f a) Source #

extended :: ( M1 i t f a -> b) -> M1 i t f a -> M1 i t f b Source #