functor-apply-0.6.0: Strong lax semimonoidal endofunctors (Applicative sans pure)

Portabilityportable
Stabilityprovisional
MaintainerEdward Kmett <ekmett@gmail.com>

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, Data.Maybe.Maybe and System.IO.IO satisfy these laws.

Methods

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

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

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

An infix synonym for fmap.

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

TODO: move into Data.Functor

FunctorApply - a strong lax semimonoidal endofunctor

class Functor f => FunctorApply f whereSource

A strong lax semi-monoidal endofunctor

Methods

(<.>) :: f (a -> b) -> f a -> f bSource

(.>) :: f a -> f b -> f bSource

a .> b = const id $ a . b

(<.) :: f a -> f b -> f aSource

(<..>) :: FunctorApply w => w a -> w (a -> b) -> w bSource

A variant of <.> with the arguments reversed.

liftF2 :: FunctorApply w => (a -> b -> c) -> w a -> w b -> w cSource

Lift a binary function into a comonad with zipping

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

Lift a ternary function into a comonad with zipping

Wrappers

newtype MaybeApply f a Source

Transform a FunctorApply into an Applicative by adding a unit.

Constructors

MaybeApply 

Fields

runMaybeApply :: Either (f a) a