semigroupoids-3.0.3: Haskell 98 semigroupoids: Category sans id

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

Data.Functor.Apply

Contents

Description

 

Synopsis

Functors

class Functor f where

The Functor class is used for types that can be mapped over. Instances of Functor should satisfy the following laws:

fmap id  ==  id
fmap (f . g)  ==  fmap f . fmap g

The instances of Functor for lists, Maybe and IO satisfy these laws.

Minimal complete definition

fmap

Methods

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

(<$) :: a -> f b -> f a infixl 4

Replace all locations in the input with the same value. The default definition is fmap . const, but this may be overridden with a more efficient version.

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

An infix synonym for fmap.

($>) :: Functor f => f a -> b -> f b infixl 4

Replace the contents of a functor uniformly with a constant value.

Apply - a strong lax semimonoidal endofunctor

class Functor f => Apply f where

A strong lax semi-monoidal endofunctor. This is equivalent to an Applicative without pure.

Laws:

associative composition: (.) <$> u <.> v <.> w = u <.> (v <.> w)

Minimal complete definition

(<.>)

Methods

(<.>) :: f (a -> b) -> f a -> f b infixl 4

(.>) :: f a -> f b -> f b infixl 4

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

(<.) :: f a -> f b -> f a infixl 4

a <. b = const <$> a <.> b

Instances

Apply [] 
Apply IO 
Apply ZipList 
Apply Maybe 
Apply IntMap

An IntMap is not Applicative, but it is an instance of Apply

Apply Tree 
Apply Seq 
Apply Option 
Apply NonEmpty 
Apply Identity 
Apply ((->) m) 
Apply (Either a) 
Semigroup m => Apply ((,) m) 
Semigroup m => Apply (Const m) 
Monad m => Apply (WrappedMonad m) 
Ord k => Apply (Map k)

A Map is not Applicative, but it is an instance of Apply

(Bind m, Monad m) => Apply (MaybeT m) 
Apply m => Apply (ListT m) 
Apply w => Apply (IdentityT w) 
Apply f => Apply (MaybeApply f) 
Applicative f => Apply (WrappedApplicative f) 
Arrow a => Apply (WrappedArrow a b) 
Apply (Cokleisli w a) 
(Apply m, Semigroup w) => Apply (WriterT w m) 
(Apply m, Semigroup w) => Apply (WriterT w m) 
Bind m => Apply (StateT s m) 
Bind m => Apply (StateT s m) 
Apply m => Apply (ReaderT e m) 
(Bind m, Monad m) => Apply (ErrorT e m) 
Apply (ContT r m) 
(Apply f, Apply g) => Apply (Compose f g) 
(Apply f, Apply g) => Apply (Product f g) 
Apply f => Apply (Static f a) 
(Bind m, Semigroup w) => Apply (RWST r w s m) 
(Bind m, Semigroup w) => Apply (RWST r w s m) 

(<..>) :: Apply w => w a -> w (a -> b) -> w b infixl 4

A variant of <.> with the arguments reversed.

liftF2 :: Apply w => (a -> b -> c) -> w a -> w b -> w c

Lift a binary function into a comonad with zipping

liftF3 :: Apply w => (a -> b -> c -> d) -> w a -> w b -> w c -> w d

Lift a ternary function into a comonad with zipping

Wrappers

newtype MaybeApply f a

Transform a Apply into an Applicative by adding a unit.

Constructors

MaybeApply 

Fields

runMaybeApply :: Either (f a) a