comonad-5.0.6: Comonads

Copyright | (C) 2008-2015 Edward Kmett (C) 2004 Dave Menendez
License | BSD-style (see the file LICENSE)
Maintainer | Edward Kmett <ekmett@gmail.com>
Stability | provisional
Portability | portable
Safe Haskell | Safe
Language | Haskell2010

Control.Comonad

Contents

- Comonads
- Combining Comonads
- Cokleisli Arrows
- Functors

Description

Synopsis

- class Functor w => Comonad w where
  - extract :: w a -> a
  - duplicate :: w a -> w (w a)
  - extend :: (w a -> b) -> w a -> w b
- liftW :: Comonad w => (a -> b) -> w a -> w b
- wfix :: Comonad w => w (w a -> a) -> a
- cfix :: Comonad w => (w a -> a) -> w a
- kfix :: ComonadApply w => w (w a -> a) -> w a
- (=>=) :: Comonad w => (w a -> b) -> (w b -> c) -> w a -> c
- (=<=) :: Comonad w => (w b -> c) -> (w a -> b) -> w a -> c
- (<<=) :: Comonad w => (w a -> b) -> w a -> w b
- (=>>) :: Comonad w => w a -> (w a -> b) -> w b
- class Comonad w => ComonadApply w where
  - (<@>) :: w (a -> b) -> w a -> w b
  - (@>) :: w a -> w b -> w b
  - (<@) :: w a -> w b -> w a
- (<@@>) :: ComonadApply w => w a -> w (a -> b) -> w b
- liftW2 :: ComonadApply w => (a -> b -> c) -> w a -> w b -> w c
- liftW3 :: ComonadApply w => (a -> b -> c -> d) -> w a -> w b -> w c -> w d
- newtype Cokleisli w a b = Cokleisli {
  - runCokleisli :: w a -> b
  }
- class Functor (f :: Type -> Type) where
  - fmap :: (a -> b) -> f a -> f b
  - (<$) :: a -> f b -> f a
- (<$>) :: Functor f => (a -> b) -> f a -> f b
- ($>) :: Functor f => f a -> b -> f b

# Comonads

class Functor w => Comonad w where Source #

There are two ways to define a comonad:

I. Provide definitions for `extract` and `extend` satisfying these laws:

    extend extract      = id
    extract . extend f  = f
    extend f . extend g = extend (f . extend g)

In this case, you may simply set `fmap` = `liftW`.

These laws are directly analogous to the laws for monads and perhaps can be made clearer by viewing them as laws stating that Cokleisli composition must be associative, and has extract for a unit:

    f =>= extract   = f
    extract =>= f   = f
    (f =>= g) =>= h = f =>= (g =>= h)

II. Alternately, you may choose to provide definitions for `fmap`, `extract`, and `duplicate` satisfying these laws:

    extract . duplicate      = id
    fmap extract . duplicate = id
    duplicate . duplicate    = fmap duplicate . duplicate

In this case you may not rely on the ability to define `fmap` in terms of `liftW`.

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

    extend f  = fmap f . duplicate
    duplicate = extend id
    fmap f    = extend (f . extract)

These are the default definitions of `extend` and `duplicate` and the definition of `liftW` respectively.

Minimal complete definition

extract, (duplicate | extend)

Methods

extract :: w a -> a Source #

    extract . fmap f = f . extract

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

    duplicate = extend id
    fmap (fmap f) . duplicate = duplicate . fmap f

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

    extend f = fmap f . duplicate

#### Instances

Instances details

Comonad Identity Source # |
Instance details Defined in Control.Comonad Methods extract :: Identity a -> a Source # duplicate :: Identity a -> Identity (Identity a) Source # extend :: (Identity a -> b) -> Identity a -> Identity b Source #
Comonad NonEmpty Source # |
Instance details Defined in Control.Comonad Methods extract :: NonEmpty a -> a Source # duplicate :: NonEmpty a -> NonEmpty (NonEmpty a) Source # extend :: (NonEmpty a -> b) -> NonEmpty a -> NonEmpty b Source #
Comonad Tree Source # |
Instance details Defined in Control.Comonad Methods extract :: Tree a -> a Source # duplicate :: Tree a -> Tree (Tree a) Source # extend :: (Tree a -> b) -> Tree a -> Tree b Source #
Comonad ((,) e) Source # |
Instance details Defined in Control.Comonad Methods extract :: (e, a) -> a Source # duplicate :: (e, a) -> (e, (e, a)) Source # extend :: ((e, a) -> b) -> (e, a) -> (e, b) Source #
Comonad (Arg e) Source # |
Instance details Defined in Control.Comonad Methods extract :: Arg e a -> a Source # duplicate :: Arg e a -> Arg e (Arg e a) Source # extend :: (Arg e a -> b) -> Arg e a -> Arg e b Source #
Comonad (Tagged s) Source # |
Instance details Defined in Control.Comonad Methods extract :: Tagged s a -> a Source # duplicate :: Tagged s a -> Tagged s (Tagged s a) Source # extend :: (Tagged s a -> b) -> Tagged s a -> Tagged s b Source #
Comonad w => Comonad (IdentityT w) Source # |
Instance details Defined in Control.Comonad Methods extract :: IdentityT w a -> a Source # duplicate :: IdentityT w a -> IdentityT w (IdentityT w a) Source # extend :: (IdentityT w a -> b) -> IdentityT w a -> IdentityT w b Source #
Comonad w => Comonad (EnvT e w) Source # |
Instance details Defined in Control.Comonad.Trans.Env Methods extract :: EnvT e w a -> a Source # duplicate :: EnvT e w a -> EnvT e w (EnvT e w a) Source # extend :: (EnvT e w a -> b) -> EnvT e w a -> EnvT e w b Source #
Comonad w => Comonad (StoreT s w) Source # |
Instance details Defined in Control.Comonad.Trans.Store Methods extract :: StoreT s w a -> a Source # duplicate :: StoreT s w a -> StoreT s w (StoreT s w a) Source # extend :: (StoreT s w a -> b) -> StoreT s w a -> StoreT s w b Source #
(Comonad w, Monoid m) => Comonad (TracedT m w) Source # |
Instance details Defined in Control.Comonad.Trans.Traced Methods extract :: TracedT m w a -> a Source # duplicate :: TracedT m w a -> TracedT m w (TracedT m w a) Source # extend :: (TracedT m w a -> b) -> TracedT m w a -> TracedT m w b Source #
Monoid m => Comonad ((->) m :: Type -> Type) Source # |
Instance details Defined in Control.Comonad Methods extract :: (m -> a) -> a Source # duplicate :: (m -> a) -> m -> (m -> a) Source # extend :: ((m -> a) -> b) -> (m -> a) -> m -> b Source #
(Comonad f, Comonad g) => Comonad (Sum f g) Source # |
Instance details Defined in Control.Comonad Methods extract :: Sum f g a -> a Source # duplicate :: Sum f g a -> Sum f g (Sum f g a) Source # extend :: (Sum f g a -> b) -> Sum f g a -> Sum f g b Source #

liftW :: Comonad w => (a -> b) -> w a -> w b Source #

A suitable default definition for `fmap` for a `Comonad`. Promotes a function to a comonad.

You can only safely use `liftW` to define `fmap` if your `Comonad` defines `extend`, not just `duplicate`, since defining `extend` in terms of duplicate uses `fmap`!

    fmap f = liftW f = extend (f . extract)

wfix :: Comonad w => w (w a -> a) -> a Source #

Comonadic fixed point à la David Menendez

cfix :: Comonad w => (w a -> a) -> w a Source #

Comonadic fixed point à la Dominic Orchard

kfix :: ComonadApply w => w (w a -> a) -> w a Source #

Comonadic fixed point à la Kenneth Foner:

This is the `evaluate` function from his "Getting a Quick Fix on Comonads" talk.

(=>=) :: Comonad w => (w a -> b) -> (w b -> c) -> w a -> c infixr 1 Source #

Left-to-right `Cokleisli` composition

(=<=) :: Comonad w => (w b -> c) -> (w a -> b) -> w a -> c infixr 1 Source #

Right-to-left `Cokleisli` composition

(<<=) :: Comonad w => (w a -> b) -> w a -> w b infixr 1 Source #

`extend` in operator form

(=>>) :: Comonad w => w a -> (w a -> b) -> w b infixl 1 Source #

`extend` with the arguments swapped. Dual to `>>=` for a `Monad`.

# Combining Comonads

class Comonad w => ComonadApply w where Source #

`ComonadApply` is to `Comonad` like `Applicative` is to `Monad`.

Mathematically, it is a strong lax symmetric semi-monoidal comonad on the category `Hask` of Haskell types. That it to say that `w` is a strong lax symmetric semi-monoidal functor on Hask, where both `extract` and `duplicate` are symmetric monoidal natural transformations.

Laws:

    (.) <$> u <@> v <@> w = u <@> (v <@> w)
    extract (p <@> q) = extract p (extract q)
    duplicate (p <@> q) = (<@>) <$> duplicate p <@> duplicate q

If our type is both a `ComonadApply` and `Applicative` we further require

    (<*>) = (<@>)

Finally, if you choose to define (`<@`) and (`@>`), the results of your definitions should match the following laws:

    a @> b = const id <$> a <@> b
    a <@ b = const <$> a <@> b

Minimal complete definition

Nothing

Methods

(<@>) :: w (a -> b) -> w a -> w b infixl 4 Source #

default (<@>) :: Applicative w => w (a -> b) -> w a -> w b Source #

(@>) :: w a -> w b -> w b infixl 4 Source #

(<@) :: w a -> w b -> w a infixl 4 Source #

#### Instances

Instances details

ComonadApply Identity Source # |
Instance details Defined in Control.Comonad Methods (<@>) :: Identity (a -> b) -> Identity a -> Identity b Source # (@>) :: Identity a -> Identity b -> Identity b Source # (<@) :: Identity a -> Identity b -> Identity a Source #
ComonadApply NonEmpty Source # |
Instance details Defined in Control.Comonad Methods (<@>) :: NonEmpty (a -> b) -> NonEmpty a -> NonEmpty b Source # (@>) :: NonEmpty a -> NonEmpty b -> NonEmpty b Source # (<@) :: NonEmpty a -> NonEmpty b -> NonEmpty a Source #
ComonadApply Tree Source # |
Instance details Defined in Control.Comonad Methods (<@>) :: Tree (a -> b) -> Tree a -> Tree b Source # (@>) :: Tree a -> Tree b -> Tree b Source # (<@) :: Tree a -> Tree b -> Tree a Source #
Semigroup m => ComonadApply ((,) m) Source # |
Instance details Defined in Control.Comonad Methods (<@>) :: (m, a -> b) -> (m, a) -> (m, b) Source # (@>) :: (m, a) -> (m, b) -> (m, b) Source # (<@) :: (m, a) -> (m, b) -> (m, a) Source #
ComonadApply w => ComonadApply (IdentityT w) Source # |
Instance details Defined in Control.Comonad Methods (<@>) :: IdentityT w (a -> b) -> IdentityT w a -> IdentityT w b Source # (@>) :: IdentityT w a -> IdentityT w b -> IdentityT w b Source # (<@) :: IdentityT w a -> IdentityT w b -> IdentityT w a Source #
(Semigroup e, ComonadApply w) => ComonadApply (EnvT e w) Source # |
Instance details Defined in Control.Comonad.Trans.Env Methods (<@>) :: EnvT e w (a -> b) -> EnvT e w a -> EnvT e w b Source # (@>) :: EnvT e w a -> EnvT e w b -> EnvT e w b Source # (<@) :: EnvT e w a -> EnvT e w b -> EnvT e w a Source #
(ComonadApply w, Semigroup s) => ComonadApply (StoreT s w) Source # |
Instance details Defined in Control.Comonad.Trans.Store Methods (<@>) :: StoreT s w (a -> b) -> StoreT s w a -> StoreT s w b Source # (@>) :: StoreT s w a -> StoreT s w b -> StoreT s w b Source # (<@) :: StoreT s w a -> StoreT s w b -> StoreT s w a Source #
(ComonadApply w, Monoid m) => ComonadApply (TracedT m w) Source # |
Instance details Defined in Control.Comonad.Trans.Traced Methods (<@>) :: TracedT m w (a -> b) -> TracedT m w a -> TracedT m w b Source # (@>) :: TracedT m w a -> TracedT m w b -> TracedT m w b Source # (<@) :: TracedT m w a -> TracedT m w b -> TracedT m w a Source #
Monoid m => ComonadApply ((->) m :: Type -> Type) Source # |
Instance details Defined in Control.Comonad Methods (<@>) :: (m -> (a -> b)) -> (m -> a) -> m -> b Source # (@>) :: (m -> a) -> (m -> b) -> m -> b Source # (<@) :: (m -> a) -> (m -> b) -> m -> a Source #

(<@@>) :: ComonadApply w => w a -> w (a -> b) -> w b infixl 4 Source #

A variant of `<@>` with the arguments reversed.

liftW2 :: ComonadApply w => (a -> b -> c) -> w a -> w b -> w c Source #

Lift a binary function into a `Comonad` with zipping

liftW3 :: ComonadApply w => (a -> b -> c -> d) -> w a -> w b -> w c -> w d Source #

Lift a ternary function into a `Comonad` with zipping

# Cokleisli Arrows

newtype Cokleisli w a b Source #

The `Cokleisli` `Arrow`s of a given `Comonad`

Constructors

Cokleisli |

Fields

- runCokleisli :: w a -> b

#### Instances

Instances details

Comonad w => Category (Cokleisli w :: Type -> Type -> Type) Source # |
Instance details Defined in Control.Comonad Methods id :: forall (a :: k). Cokleisli w a a (.) :: forall (b :: k) (c :: k) (a :: k). Cokleisli w b c -> Cokleisli w a b -> Cokleisli w a c
Comonad w => Arrow (Cokleisli w) Source # |
Instance details Defined in Control.Comonad Methods arr :: (b -> c) -> Cokleisli w b c first :: Cokleisli w b c -> Cokleisli w (b, d) (c, d) second :: Cokleisli w b c -> Cokleisli w (d, b) (d, c) (***) :: Cokleisli w b c -> Cokleisli w b' c' -> Cokleisli w (b, b') (c, c') (&&&) :: Cokleisli w b c -> Cokleisli w b c' -> Cokleisli w b (c, c')
Comonad w => ArrowApply (Cokleisli w) Source # |
Instance details Defined in Control.Comonad Methods app :: Cokleisli w (Cokleisli w b c, b) c
Comonad w => ArrowChoice (Cokleisli w) Source # |
Instance details Defined in Control.Comonad Methods left :: Cokleisli w b c -> Cokleisli w (Either b d) (Either c d) right :: Cokleisli w b c -> Cokleisli w (Either d b) (Either d c) (+++) :: Cokleisli w b c -> Cokleisli w b' c' -> Cokleisli w (Either b b') (Either c c') (|||) :: Cokleisli w b d -> Cokleisli w c d -> Cokleisli w (Either b c) d
ComonadApply w => ArrowLoop (Cokleisli w) Source # |
Instance details Defined in Control.Comonad Methods loop :: Cokleisli w (b, d) (c, d) -> Cokleisli w b c
Monad (Cokleisli w a) Source # |
Instance details Defined in Control.Comonad Methods (>>=) :: Cokleisli w a a0 -> (a0 -> Cokleisli w a b) -> Cokleisli w a b (>>) :: Cokleisli w a a0 -> Cokleisli w a b -> Cokleisli w a b return :: a0 -> Cokleisli w a a0
Functor (Cokleisli w a) Source # |
Instance details Defined in Control.Comonad Methods fmap :: (a0 -> b) -> Cokleisli w a a0 -> Cokleisli w a b # (<$) :: a0 -> Cokleisli w a b -> Cokleisli w a a0 #
Applicative (Cokleisli w a) Source # |
Instance details Defined in Control.Comonad Methods pure :: a0 -> Cokleisli w a a0 (<*>) :: Cokleisli w a (a0 -> b) -> Cokleisli w a a0 -> Cokleisli w a b liftA2 :: (a0 -> b -> c) -> Cokleisli w a a0 -> Cokleisli w a b -> Cokleisli w a c (*>) :: Cokleisli w a a0 -> Cokleisli w a b -> Cokleisli w a b (<*) :: Cokleisli w a a0 -> Cokleisli w a b -> Cokleisli w a a0

# Functors

class Functor (f :: Type -> Type) where #

Minimal complete definition

fmap

Methods

fmap :: (a -> b) -> f a -> f b #

(<$) :: a -> f b -> f a #

#### Instances

Instances details

Functor [] |
Instance details Defined in GHC.Base Methods fmap :: (a -> b) -> [a] -> [b] # (<$) :: a -> [b] -> [a] #
Functor Maybe |
Instance details Defined in GHC.Base Methods fmap :: (a -> b) -> Maybe a -> Maybe b # (<$) :: a -> Maybe b -> Maybe a #
Functor IO |
Instance details Defined in GHC.Base Methods fmap :: (a -> b) -> IO a -> IO b # (<$) :: a -> IO b -> IO a #
Functor Par1 |
Instance details Defined in GHC.Generics Methods fmap :: (a -> b) -> Par1 a -> Par1 b # (<$) :: a -> Par1 b -> Par1 a #
Functor Identity |
Instance details Defined in Data.Functor.Identity Methods fmap :: (a -> b) -> Identity a -> Identity b # (<$) :: a -> Identity b -> Identity a #
Functor ZipList |
Instance details Defined in Control.Applicative Methods fmap :: (a -> b) -> ZipList a -> ZipList b # (<$) :: a -> ZipList b -> ZipList a #
Functor P |
Instance details Defined in Text.ParserCombinators.ReadP Methods fmap :: (a -> b) -> P a -> P b # (<$) :: a -> P b -> P a #
Functor ReadP |
Instance details Defined in Text.ParserCombinators.ReadP Methods fmap :: (a -> b) -> ReadP a -> ReadP b # (<$) :: a -> ReadP b -> ReadP a #
Functor Product |
Instance details Defined in Data.Semigroup.Internal Methods fmap :: (a -> b) -> Product a -> Product b # (<$) :: a -> Product b -> Product a #
Functor Sum |
Instance details Defined in Data.Semigroup.Internal Methods fmap :: (a -> b) -> Sum a -> Sum b # (<$) :: a -> Sum b -> Sum a #
Functor NonEmpty |
Instance details Defined in GHC.Base Methods fmap :: (a -> b) -> NonEmpty a -> NonEmpty b # (<$) :: a -> NonEmpty b -> NonEmpty a #
Functor Dual |
Instance details Defined in Data.Semigroup.Internal Methods fmap :: (a -> b) -> Dual a -> Dual b # (<$) :: a -> Dual b -> Dual a #
Functor First |
Instance details Defined in Data.Semigroup Methods fmap :: (a -> b) -> First a -> First b # (<$) :: a -> First b -> First a #
Functor Last |
Instance details Defined in Data.Semigroup Methods fmap :: (a -> b) -> Last a -> Last b # (<$) :: a -> Last b -> Last a #
Functor Max |
Instance details Defined in Data.Semigroup Methods fmap :: (a -> b) -> Max a -> Max b # (<$) :: a -> Max b -> Max a #
Functor Min |
Instance details Defined in Data.Semigroup Methods fmap :: (a -> b) -> Min a -> Min b # (<$) :: a -> Min b -> Min a #
Functor Option |
Instance details Defined in Data.Semigroup Methods fmap :: (a -> b) -> Option a -> Option b # (<$) :: a -> Option b -> Option a #
Functor Down |
Instance details Defined in Data.Ord Methods fmap :: (a -> b) -> Down a -> Down b # (<$) :: a -> Down b -> Down a #
Functor First |
Instance details Defined in Data.Monoid Methods fmap :: (a -> b) -> First a -> First b # (<$) :: a -> First b -> First a #
Functor Last |
Instance details Defined in Data.Monoid Methods fmap :: (a -> b) -> Last a -> Last b # (<$) :: a -> Last b -> Last a #
Functor Tree |
Instance details Defined in Data.Tree Methods fmap :: (a -> b) -> Tree a -> Tree b # (<$) :: a -> Tree b -> Tree a #
Functor Seq |
Instance details Defined in Data.Sequence.Internal Methods fmap :: (a -> b) -> Seq a -> Seq b # (<$) :: a -> Seq b -> Seq a #
Functor Elem |
Instance details Defined in Data.Sequence.Internal Methods fmap :: (a -> b) -> Elem a -> Elem b # (<$) :: a -> Elem b -> Elem a #
Functor Node |
Instance details Defined in Data.Sequence.Internal Methods fmap :: (a -> b) -> Node a -> Node b # (<$) :: a -> Node b -> Node a #
Functor FingerTree |
Instance details Defined in Data.Sequence.Internal Methods fmap :: (a -> b) -> FingerTree a -> FingerTree b # (<$) :: a -> FingerTree b -> FingerTree a #
Functor Digit |
Instance details Defined in Data.Sequence.Internal Methods fmap :: (a -> b) -> Digit a -> Digit b # (<$) :: a -> Digit b -> Digit a #
Functor ViewL |
Instance details Defined in Data.Sequence.Internal Methods fmap :: (a -> b) -> ViewL a -> ViewL b # (<$) :: a -> ViewL b -> ViewL a #
Functor ViewR |
Instance details Defined in Data.Sequence.Internal Methods fmap :: (a -> b) -> ViewR a -> ViewR b # (<$) :: a -> ViewR b -> ViewR a #
Functor Complex |
Instance details Defined in Data.Complex Methods fmap :: (a -> b) -> Complex a -> Complex b # (<$) :: a -> Complex b -> Complex a #
Functor (Either a) |
Instance details Defined in Data.Either Methods fmap :: (a0 -> b) -> Either a a0 -> Either a b # (<$) :: a0 -> Either a b -> Either a a0 #
Functor (V1 :: Type -> Type) |
Instance details Defined in GHC.Generics Methods fmap :: (a -> b) -> V1 a -> V1 b # (<$) :: a -> V1 b -> V1 a #
Functor (U1 :: Type -> Type) |
Instance details Defined in GHC.Generics Methods fmap :: (a -> b) -> U1 a -> U1 b # (<$) :: a -> U1 b -> U1 a #
Functor ((,) a) |
Instance details Defined in GHC.Base Methods fmap :: (a0 -> b) -> (a, a0) -> (a, b) # (<$) :: a0 -> (a, b) -> (a, a0) #
Functor (Proxy :: Type -> Type) |
Instance details Defined in Data.Proxy Methods fmap :: (a -> b) -> Proxy a -> Proxy b # (<$) :: a -> Proxy b -> Proxy a #
Monad m => Functor (WrappedMonad m) |
Instance details Defined in Control.Applicative Methods fmap :: (a -> b) -> WrappedMonad m a -> WrappedMonad m b # (<$) :: a -> WrappedMonad m b -> WrappedMonad m a #
Arrow a => Functor (ArrowMonad a) |
Instance details Defined in Control.Arrow Methods fmap :: (a0 -> b) -> ArrowMonad a a0 -> ArrowMonad a b # (<$) :: a0 -> ArrowMonad a b -> ArrowMonad a a0 #
Functor (Arg a) |
Instance details Defined in Data.Semigroup Methods fmap :: (a0 -> b) -> Arg a a0 -> Arg a b # (<$) :: a0 -> Arg a b -> Arg a a0 #
Functor (Array i) |
Instance details Defined in GHC.Arr Methods fmap :: (a -> b) -> Array i a -> Array i b # (<$) :: a -> Array i b -> Array i a #
Functor f => Functor (Rec1 f) |
Instance details Defined in GHC.Generics Methods fmap :: (a -> b) -> Rec1 f a -> Rec1 f b # (<$) :: a -> Rec1 f b -> Rec1 f a #
Functor (URec Char :: Type -> Type) |
Instance details Defined in GHC.Generics Methods fmap :: (a -> b) -> URec Char a -> URec Char b # (<$) :: a -> URec Char b -> URec Char a #
Functor (URec Double :: Type -> Type) |
Instance details Defined in GHC.Generics Methods fmap :: (a -> b) -> URec Double a -> URec Double b # (<$) :: a -> URec Double b -> URec Double a #
Functor (URec Float :: Type -> Type) |
Instance details Defined in GHC.Generics Methods fmap :: (a -> b) -> URec Float a -> URec Float b # (<$) :: a -> URec Float b -> URec Float a #
Functor (URec Int :: Type -> Type) |
Instance details Defined in GHC.Generics Methods fmap :: (a -> b) -> URec Int a -> URec Int b # (<$) :: a -> URec Int b -> URec Int a #
Functor (URec Word :: Type -> Type) |
Instance details Defined in GHC.Generics Methods fmap :: (a -> b) -> URec Word a -> URec Word b # (<$) :: a -> URec Word b -> URec Word a #
Functor (URec (Ptr ()) :: Type -> Type) |
Instance details Defined in GHC.Generics Methods fmap :: (a -> b) -> URec (Ptr ()) a -> URec (Ptr ()) b # (<$) :: a -> URec (Ptr ()) b -> URec (Ptr ()) a #
Functor (Tagged s) |
Instance details Defined in Data.Tagged Methods fmap :: (a -> b) -> Tagged s a -> Tagged s b # (<$) :: a -> Tagged s b -> Tagged s a #
Arrow a => Functor (WrappedArrow a b) |
Instance details Defined in Control.Applicative Methods fmap :: (a0 -> b0) -> WrappedArrow a b a0 -> WrappedArrow a b b0 # (<$) :: a0 -> WrappedArrow a b b0 -> WrappedArrow a b a0 #
Functor (Const m :: Type -> Type) |
Instance details Defined in Data.Functor.Const Methods fmap :: (a -> b) -> Const m a -> Const m b # (<$) :: a -> Const m b -> Const m a #
Functor m => Functor (IdentityT m) |
Instance details Defined in Control.Monad.Trans.Identity Methods fmap :: (a -> b) -> IdentityT m a -> IdentityT m b # (<$) :: a -> IdentityT m b -> IdentityT m a #
Functor f => Functor (Alt f) |
Instance details Defined in Data.Semigroup.Internal Methods fmap :: (a -> b) -> Alt f a -> Alt f b # (<$) :: a -> Alt f b -> Alt f a #
Functor f => Functor (Ap f) |
Instance details Defined in Data.Monoid Methods fmap :: (a -> b) -> Ap f a -> Ap f b # (<$) :: a -> Ap f b -> Ap f a #
Functor w => Functor (EnvT e w) Source # |
Instance details Defined in Control.Comonad.Trans.Env Methods fmap :: (a -> b) -> EnvT e w a -> EnvT e w b # (<$) :: a -> EnvT e w b -> EnvT e w a #
Functor w => Functor (StoreT s w) Source # |
Instance details Defined in Control.Comonad.Trans.Store Methods fmap :: (a -> b) -> StoreT s w a -> StoreT s w b # (<$) :: a -> StoreT s w b -> StoreT s w a #
Functor f => Functor (Backwards f) |
Instance details Defined in Control.Applicative.Backwards Methods fmap :: (a -> b) -> Backwards f a -> Backwards f b # (<$) :: a -> Backwards f b -> Backwards f a #
Functor m => Functor (ReaderT r m) |
Instance details Defined in Control.Monad.Trans.Reader Methods fmap :: (a -> b) -> ReaderT r m a -> ReaderT r m b # (<$) :: a -> ReaderT r m b -> ReaderT r m a #
Functor f => Functor (Reverse f) |
Instance details Defined in Data.Functor.Reverse Methods fmap :: (a -> b) -> Reverse f a -> Reverse f b # (<$) :: a -> Reverse f b -> Reverse f a #
Functor w => Functor (TracedT m w) Source # |
Instance details Defined in Control.Comonad.Trans.Traced Methods fmap :: (a -> b) -> TracedT m w a -> TracedT m w b # (<$) :: a -> TracedT m w b -> TracedT m w a #
Functor ((->) r :: Type -> Type) |
Instance details Defined in GHC.Base Methods fmap :: (a -> b) -> (r -> a) -> r -> b # (<$) :: a -> (r -> b) -> r -> a #
Functor (K1 i c :: Type -> Type) |
Instance details Defined in GHC.Generics Methods fmap :: (a -> b) -> K1 i c a -> K1 i c b # (<$) :: a -> K1 i c b -> K1 i c a #
(Functor f, Functor g) => Functor (f :+: g) |
Instance details Defined in GHC.Generics Methods fmap :: (a -> b) -> (f :+: g) a -> (f :+: g) b # (<$) :: a -> (f :+: g) b -> (f :+: g) a #
(Functor f, Functor g) => Functor (f :*: g) |
Instance details Defined in GHC.Generics Methods fmap :: (a -> b) -> (f :*: g) a -> (f :*: g) b # (<$) :: a -> (f :*: g) b -> (f :*: g) a #
(Functor f, Functor g) => Functor (Sum f g) |
Instance details Defined in Data.Functor.Sum Methods fmap :: (a -> b) -> Sum f g a -> Sum f g b # (<$) :: a -> Sum f g b -> Sum f g a #
Functor (Cokleisli w a) Source # |
Instance details Defined in Control.Comonad Methods fmap :: (a0 -> b) -> Cokleisli w a a0 -> Cokleisli w a b # (<$) :: a0 -> Cokleisli w a b -> Cokleisli w a a0 #
(Functor f, Functor g) => Functor (Product f g) |
Instance details Defined in Data.Functor.Product Methods fmap :: (a -> b) -> Product f g a -> Product f g b # (<$) :: a -> Product f g b -> Product f g a #
Functor f => Functor (M1 i c f) |
Instance details Defined in GHC.Generics Methods fmap :: (a -> b) -> M1 i c f a -> M1 i c f b # (<$) :: a -> M1 i c f b -> M1 i c f a #
(Functor f, Functor g) => Functor (f :.: g) |
Instance details Defined in GHC.Generics Methods fmap :: (a -> b) -> (f :.: g) a -> (f :.: g) b # (<$) :: a -> (f :.: g) b -> (f :.: g) a #
(Functor f, Functor g) => Functor (Compose f g) |
Instance details Defined in Data.Functor.Compose Methods fmap :: (a -> b) -> Compose f g a -> Compose f g b # (<$) :: a -> Compose f g b -> Compose f g a #

(<$>) :: Functor f => (a -> b) -> f a -> f b #

($>) :: Functor f => f a -> b -> f b #