semigroupoids-5.1: Semigroupoids: Category sans id

Data.Functor.Apply

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

Instances

 Functor [] Methodsfmap :: (a -> b) -> [a] -> [b] #(<$) :: a -> [b] -> [a] # Methodsfmap :: (a -> b) -> Maybe a -> Maybe b #(<$) :: a -> Maybe b -> Maybe a # Methodsfmap :: (a -> b) -> IO a -> IO b #(<$) :: a -> IO b -> IO a # Methodsfmap :: (a -> b) -> V1 a -> V1 b #(<$) :: a -> V1 b -> V1 a # Methodsfmap :: (a -> b) -> U1 a -> U1 b #(<$) :: a -> U1 b -> U1 a # Methodsfmap :: (a -> b) -> Par1 a -> Par1 b #(<$) :: a -> Par1 b -> Par1 a # Functor Id Methodsfmap :: (a -> b) -> Id a -> Id b #(<$) :: a -> Id b -> Id a # Methodsfmap :: (a -> b) -> Identity a -> Identity b #(<$) :: a -> Identity b -> Identity a # Methodsfmap :: (a -> b) -> Min a -> Min b #(<$) :: a -> Min b -> Min a # Methodsfmap :: (a -> b) -> Max a -> Max b #(<$) :: a -> Max b -> Max a # Methodsfmap :: (a -> b) -> First a -> First b #(<$) :: a -> First b -> First a # Methodsfmap :: (a -> b) -> Last a -> Last b #(<$) :: a -> Last b -> Last a # Methodsfmap :: (a -> b) -> Option a -> Option b #(<$) :: a -> Option b -> Option a # Methodsfmap :: (a -> b) -> NonEmpty a -> NonEmpty b #(<$) :: a -> NonEmpty b -> NonEmpty a # Methodsfmap :: (a -> b) -> Complex a -> Complex b #(<$) :: a -> Complex b -> Complex a # Methodsfmap :: (a -> b) -> ZipList a -> ZipList b #(<$) :: a -> ZipList b -> ZipList a # Methodsfmap :: (a -> b) -> Handler a -> Handler b #(<$) :: a -> Handler b -> Handler a # Methodsfmap :: (a -> b) -> Dual a -> Dual b #(<$) :: a -> Dual b -> Dual a # Methodsfmap :: (a -> b) -> Sum a -> Sum b #(<$) :: a -> Sum b -> Sum a # Methodsfmap :: (a -> b) -> Product a -> Product b #(<$) :: a -> Product b -> Product a # Methodsfmap :: (a -> b) -> First a -> First b #(<$) :: a -> First b -> First a # Methodsfmap :: (a -> b) -> Last a -> Last b #(<$) :: a -> Last b -> Last a # Functor Id Methodsfmap :: (a -> b) -> Id a -> Id b #(<$) :: a -> Id b -> Id a # Functor Digit Methodsfmap :: (a -> b) -> Digit a -> Digit b #(<$) :: a -> Digit b -> Digit a # Functor Node Methodsfmap :: (a -> b) -> Node a -> Node b #(<$) :: a -> Node b -> Node a # Functor Elem Methodsfmap :: (a -> b) -> Elem a -> Elem b #(<$) :: a -> Elem b -> Elem a # Functor FingerTree Methodsfmap :: (a -> b) -> FingerTree a -> FingerTree b #(<$) :: a -> FingerTree b -> FingerTree a # Methodsfmap :: (a -> b) -> Tree a -> Tree b #(<$) :: a -> Tree b -> Tree a # Methodsfmap :: (a -> b) -> Seq a -> Seq b #(<$) :: a -> Seq b -> Seq a # Methodsfmap :: (a -> b) -> ViewL a -> ViewL b #(<$) :: a -> ViewL b -> ViewL a # Methodsfmap :: (a -> b) -> ViewR a -> ViewR b #(<$) :: a -> ViewR b -> ViewR a # Methodsfmap :: (a -> b) -> IntMap a -> IntMap b #(<$) :: a -> IntMap b -> IntMap a # Functor ((->) r) Methodsfmap :: (a -> b) -> (r -> a) -> r -> b #(<$) :: a -> (r -> b) -> r -> a # Methodsfmap :: (a -> b) -> Either a a -> Either a b #(<$) :: a -> Either a b -> Either a a # Functor f => Functor (Rec1 f) Methodsfmap :: (a -> b) -> Rec1 f a -> Rec1 f b #(<$) :: a -> Rec1 f b -> Rec1 f a # Methodsfmap :: (a -> b) -> URec Char a -> URec Char b #(<$) :: a -> URec Char b -> URec Char a # Methodsfmap :: (a -> b) -> URec Double a -> URec Double b #(<$) :: a -> URec Double b -> URec Double a # Methodsfmap :: (a -> b) -> URec Float a -> URec Float b #(<$) :: a -> URec Float b -> URec Float a # Methodsfmap :: (a -> b) -> URec Int a -> URec Int b #(<$) :: a -> URec Int b -> URec Int a # Methodsfmap :: (a -> b) -> URec Word a -> URec Word b #(<$) :: a -> URec Word b -> URec Word a # Functor (URec (Ptr ())) Methodsfmap :: (a -> b) -> URec (Ptr ()) a -> URec (Ptr ()) b #(<$) :: a -> URec (Ptr ()) b -> URec (Ptr ()) a # Functor ((,) a) Methodsfmap :: (a -> b) -> (a, a) -> (a, b) #(<$) :: a -> (a, b) -> (a, a) # Functor (Array i) Methodsfmap :: (a -> b) -> Array i a -> Array i b #(<$) :: a -> Array i b -> Array i a # Functor (StateL s) Methodsfmap :: (a -> b) -> StateL s a -> StateL s b #(<$) :: a -> StateL s b -> StateL s a # Functor (StateR s) Methodsfmap :: (a -> b) -> StateR s a -> StateR s b #(<$) :: a -> StateR s b -> StateR s a # Functor (Arg a) Methodsfmap :: (a -> b) -> Arg a a -> Arg a b #(<$) :: a -> Arg a b -> Arg a a # Monad m => Functor (WrappedMonad m) Methodsfmap :: (a -> b) -> WrappedMonad m a -> WrappedMonad m b #(<$) :: a -> WrappedMonad m b -> WrappedMonad m a # Arrow a => Functor (ArrowMonad a) Methodsfmap :: (a -> b) -> ArrowMonad a a -> ArrowMonad a b #(<$) :: a -> ArrowMonad a b -> ArrowMonad a a # Methodsfmap :: (a -> b) -> Proxy * a -> Proxy * b #(<$) :: a -> Proxy * b -> Proxy * a # Functor (StateL s) Methodsfmap :: (a -> b) -> StateL s a -> StateL s b #(<$) :: a -> StateL s b -> StateL s a # Functor (StateR s) Methodsfmap :: (a -> b) -> StateR s a -> StateR s b #(<$) :: a -> StateR s b -> StateR s a # Functor (State s) Methodsfmap :: (a -> b) -> State s a -> State s b #(<$) :: a -> State s b -> State s a # Functor (Map k) Methodsfmap :: (a -> b) -> Map k a -> Map k b #(<$) :: a -> Map k b -> Map k a # Functor f => Functor (Lift f) Methodsfmap :: (a -> b) -> Lift f a -> Lift f b #(<$) :: a -> Lift f b -> Lift f a # Functor m => Functor (MaybeT m) Methodsfmap :: (a -> b) -> MaybeT m a -> MaybeT m b #(<$) :: a -> MaybeT m b -> MaybeT m a # Functor m => Functor (ListT m) Methodsfmap :: (a -> b) -> ListT m a -> ListT m b #(<$) :: a -> ListT m b -> ListT m a # Functor f => Functor (MaybeApply f) # Methodsfmap :: (a -> b) -> MaybeApply f a -> MaybeApply f b #(<$) :: a -> MaybeApply f b -> MaybeApply f a # # Methodsfmap :: (a -> b) -> WrappedApplicative f a -> WrappedApplicative f b #(<$) :: a -> WrappedApplicative f b -> WrappedApplicative f a # Functor (K1 i c) Methodsfmap :: (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) Methodsfmap :: (a -> b) -> (f :+: g) a -> (f :+: g) b #(<$) :: a -> (f :+: g) b -> (f :+: g) a # (Functor f, Functor g) => Functor ((:*:) f g) Methodsfmap :: (a -> b) -> (f :*: g) a -> (f :*: g) b #(<$) :: a -> (f :*: g) b -> (f :*: g) a # (Functor f, Functor g) => Functor ((:.:) f g) Methodsfmap :: (a -> b) -> (f :.: g) a -> (f :.: g) b #(<$) :: a -> (f :.: g) b -> (f :.: g) a # Arrow a => Functor (WrappedArrow a b) Methodsfmap :: (a -> b) -> WrappedArrow a b a -> WrappedArrow a b b #(<$) :: a -> WrappedArrow a b b -> WrappedArrow a b a # Methodsfmap :: (a -> b) -> Const * m a -> Const * m b #(<$) :: a -> Const * m b -> Const * m a # Functor f => Functor (Alt * f) Methodsfmap :: (a -> b) -> Alt * f a -> Alt * f b #(<$) :: a -> Alt * f b -> Alt * f a # Bifunctor p => Functor (Join * p) Methodsfmap :: (a -> b) -> Join * p a -> Join * p b #(<$) :: a -> Join * p b -> Join * p a # Functor w => Functor (TracedT m w) Methodsfmap :: (a -> b) -> TracedT m w a -> TracedT m w b #(<$) :: a -> TracedT m w b -> TracedT m w a # Functor w => Functor (StoreT s w) Methodsfmap :: (a -> b) -> StoreT s w a -> StoreT s w b #(<$) :: a -> StoreT s w b -> StoreT s w a # Functor w => Functor (EnvT e w) Methodsfmap :: (a -> b) -> EnvT e w a -> EnvT e w b #(<$) :: a -> EnvT e w b -> EnvT e w a # Functor (Cokleisli w a) Methodsfmap :: (a -> b) -> Cokleisli w a a -> Cokleisli w a b #(<$) :: a -> Cokleisli w a b -> Cokleisli w a a # Functor m => Functor (IdentityT * m) Methodsfmap :: (a -> b) -> IdentityT * m a -> IdentityT * m b #(<$) :: a -> IdentityT * m b -> IdentityT * m a # Functor (Tagged k s) Methodsfmap :: (a -> b) -> Tagged k s a -> Tagged k s b #(<$) :: a -> Tagged k s b -> Tagged k s a # Functor f => Functor (Reverse * f) Derived instance. Methodsfmap :: (a -> b) -> Reverse * f a -> Reverse * f b #(<$) :: a -> Reverse * f b -> Reverse * f a # Functor f => Functor (Backwards * f) Derived instance. Methodsfmap :: (a -> b) -> Backwards * f a -> Backwards * f b #(<$) :: a -> Backwards * f b -> Backwards * f a # Functor m => Functor (WriterT w m) Methodsfmap :: (a -> b) -> WriterT w m a -> WriterT w m b #(<$) :: a -> WriterT w m b -> WriterT w m a # Functor m => Functor (WriterT w m) Methodsfmap :: (a -> b) -> WriterT w m a -> WriterT w m b #(<$) :: a -> WriterT w m b -> WriterT w m a # Functor m => Functor (StateT s m) Methodsfmap :: (a -> b) -> StateT s m a -> StateT s m b #(<$) :: a -> StateT s m b -> StateT s m a # Functor m => Functor (StateT s m) Methodsfmap :: (a -> b) -> StateT s m a -> StateT s m b #(<$) :: a -> StateT s m b -> StateT s m a # Functor m => Functor (ErrorT e m) Methodsfmap :: (a -> b) -> ErrorT e m a -> ErrorT e m b #(<$) :: a -> ErrorT e m b -> ErrorT e m a # Functor m => Functor (ExceptT e m) Methodsfmap :: (a -> b) -> ExceptT e m a -> ExceptT e m b #(<$) :: a -> ExceptT e m b -> ExceptT e m a # Methodsfmap :: (a -> b) -> Constant * a a -> Constant * a b #(<$) :: a -> Constant * a b -> Constant * a a # Functor f => Functor (Static f a) # Methodsfmap :: (a -> b) -> Static f a a -> Static f a b #(<$) :: a -> Static f a b -> Static f a a # Functor f => Functor (M1 i c f) Methodsfmap :: (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 (Sum * f g) Methodsfmap :: (a -> b) -> Sum * f g a -> Sum * f g b #(<$) :: a -> Sum * f g b -> Sum * f g a # (Functor f, Functor g) => Functor (Product * f g) Methodsfmap :: (a -> b) -> Product * f g a -> Product * f g b #(<$) :: a -> Product * f g b -> Product * f g a # Functor m => Functor (ReaderT * r m) Methodsfmap :: (a -> b) -> ReaderT * r m a -> ReaderT * r m b #(<$) :: a -> ReaderT * r m b -> ReaderT * r m a # Functor (ContT k r m) Methodsfmap :: (a -> b) -> ContT k r m a -> ContT k r m b #(<$) :: a -> ContT k r m b -> ContT k r m a # (Functor f, Functor g) => Functor (Compose * * f g) Methodsfmap :: (a -> b) -> Compose * * f g a -> Compose * * f g b #(<$) :: a -> Compose * * f g b -> Compose * * f g a # Bifunctor p => Functor (WrappedBifunctor * * p a) Methodsfmap :: (a -> b) -> WrappedBifunctor * * p a a -> WrappedBifunctor * * p a b #(<$) :: a -> WrappedBifunctor * * p a b -> WrappedBifunctor * * p a a # Functor g => Functor (Joker k * g a) Methodsfmap :: (a -> b) -> Joker k * g a a -> Joker k * g a b #(<$) :: a -> Joker k * g a b -> Joker k * g a a # Bifunctor p => Functor (Flip * * p a) Methodsfmap :: (a -> b) -> Flip * * p a a -> Flip * * p a b #(<$) :: a -> Flip * * p a b -> Flip * * p a a # Functor (Clown * k f a) Methodsfmap :: (a -> b) -> Clown * k f a a -> Clown * k f a b #(<$) :: a -> Clown * k f a b -> Clown * k f a a # Functor m => Functor (RWST r w s m) Methodsfmap :: (a -> b) -> RWST r w s m a -> RWST r w s m b #(<$) :: a -> RWST r w s m b -> RWST r w s m a # Functor m => Functor (RWST r w s m) Methodsfmap :: (a -> b) -> RWST r w s m a -> RWST r w s m b #(<$) :: a -> RWST r w s m b -> RWST r w s m a # (Functor f, Bifunctor p) => Functor (Tannen * * * f p a) Methodsfmap :: (a -> b) -> Tannen * * * f p a a -> Tannen * * * f p a b #(<$) :: a -> Tannen * * * f p a b -> Tannen * * * f p a a # (Bifunctor p, Functor g) => Functor (Biff * k * * p f g a) Methodsfmap :: (a -> b) -> Biff * k * * p f g a a -> Biff * k * * p f g a b #(<$) :: a -> Biff * k * * p f g a b -> Biff * k * * p f g a a #

(<$>) :: Functor f => (a -> b) -> f a -> f b infixl 4 # An infix synonym for fmap. The name of this operator is an allusion to $. Note the similarities between their types:

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

Whereas $ is function application, <$> is function application lifted over a Functor.

#### Examples

Convert from a Maybe Int to a Maybe String using show:

>>> show <$> Nothing Nothing >>> show <$> Just 3
Just "3"


Convert from an Either Int Int to an Either Int String using show:

>>> show <$> Left 17 Left 17 >>> show <$> Right 17
Right "17"


Double each element of a list:

>>> (*2) <$> [1,2,3] [2,4,6]  Apply even to the second element of a pair: >>> even <$> (2,2)
(2,True)


($>) :: Functor f => f a -> b -> f b infixl 4 # Flipped version of <$.

#### Examples

Replace the contents of a Maybe Int with a constant String:

>>> Nothing $> "foo" Nothing >>> Just 90210$> "foo"
Just "foo"


Replace the contents of an Either Int Int with a constant String, resulting in an Either Int String:

>>> Left 8675309 $> "foo" Left 8675309 >>> Right 8675309$> "foo"
Right "foo"


Replace each element of a list with a constant String:

>>> [1,2,3] $> "foo" ["foo","foo","foo"]  Replace the second element of a pair with a constant String: >>> (1,2)$> "foo"
(1,"foo")


Since: 4.7.0.0

# Apply - a strong lax semimonoidal endofunctor

class Functor f => Apply f where Source #

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

Laws:

(.) <$> u <.> v <.> w = u <.> (v <.> w) x <.> (f <$> y) = (. f) <$> x <.> y f <$> (x <.> y) = (f .) <$> x <.> y  The laws imply that .> and <. really ignore their left and right results, respectively, and really return their right and left results, respectively. Specifically, (mf <$> m) .> (nf <$> n) = nf <$> (m .> n)
(mf <$> m) <. (nf <$> n) = mf <$> (m <. n)  Minimal complete definition (<.>) Methods (<.>) :: f (a -> b) -> f a -> f b infixl 4 Source # (.>) :: f a -> f b -> f b infixl 4 Source #  a .> b = const id <$> a <.> b

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

 a <. b = const <$> a <.> b Instances  Apply [] Source # Methods(<.>) :: [a -> b] -> [a] -> [b] Source #(.>) :: [a] -> [b] -> [b] Source #(<.) :: [a] -> [b] -> [a] Source # Source # Methods(<.>) :: Maybe (a -> b) -> Maybe a -> Maybe b Source #(.>) :: Maybe a -> Maybe b -> Maybe b Source #(<.) :: Maybe a -> Maybe b -> Maybe a Source # Source # Methods(<.>) :: IO (a -> b) -> IO a -> IO b Source #(.>) :: IO a -> IO b -> IO b Source #(<.) :: IO a -> IO b -> IO a Source # Source # Methods(<.>) :: Identity (a -> b) -> Identity a -> Identity b Source #(.>) :: Identity a -> Identity b -> Identity b Source #(<.) :: Identity a -> Identity b -> Identity a Source # Source # Methods(<.>) :: Option (a -> b) -> Option a -> Option b Source #(.>) :: Option a -> Option b -> Option b Source #(<.) :: Option a -> Option b -> Option a Source # Source # Methods(<.>) :: NonEmpty (a -> b) -> NonEmpty a -> NonEmpty b Source #(.>) :: NonEmpty a -> NonEmpty b -> NonEmpty b Source #(<.) :: NonEmpty a -> NonEmpty b -> NonEmpty a Source # Source # Methods(<.>) :: ZipList (a -> b) -> ZipList a -> ZipList b Source #(.>) :: ZipList a -> ZipList b -> ZipList b Source #(<.) :: ZipList a -> ZipList b -> ZipList a Source # Source # Methods(<.>) :: Tree (a -> b) -> Tree a -> Tree b Source #(.>) :: Tree a -> Tree b -> Tree b Source #(<.) :: Tree a -> Tree b -> Tree a Source # Source # Methods(<.>) :: Seq (a -> b) -> Seq a -> Seq b Source #(.>) :: Seq a -> Seq b -> Seq b Source #(<.) :: Seq a -> Seq b -> Seq a Source # Source # An IntMap is not Applicative, but it is an instance of Apply Methods(<.>) :: IntMap (a -> b) -> IntMap a -> IntMap b Source #(.>) :: IntMap a -> IntMap b -> IntMap b Source #(<.) :: IntMap a -> IntMap b -> IntMap a Source # Apply ((->) m) Source # Methods(<.>) :: (m -> a -> b) -> (m -> a) -> m -> b Source #(.>) :: (m -> a) -> (m -> b) -> m -> b Source #(<.) :: (m -> a) -> (m -> b) -> m -> a Source # Apply (Either a) Source # Methods(<.>) :: Either a (a -> b) -> Either a a -> Either a b Source #(.>) :: Either a a -> Either a b -> Either a b Source #(<.) :: Either a a -> Either a b -> Either a a Source # Semigroup m => Apply ((,) m) Source # Methods(<.>) :: (m, a -> b) -> (m, a) -> (m, b) Source #(.>) :: (m, a) -> (m, b) -> (m, b) Source #(<.) :: (m, a) -> (m, b) -> (m, a) Source # Monad m => Apply (WrappedMonad m) Source # Methods(<.>) :: WrappedMonad m (a -> b) -> WrappedMonad m a -> WrappedMonad m b Source #(.>) :: WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m b Source #(<.) :: WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m a Source # Ord k => Apply (Map k) Source # A Map is not Applicative, but it is an instance of Apply Methods(<.>) :: Map k (a -> b) -> Map k a -> Map k b Source #(.>) :: Map k a -> Map k b -> Map k b Source #(<.) :: Map k a -> Map k b -> Map k a Source # Apply f => Apply (Lift f) Source # Methods(<.>) :: Lift f (a -> b) -> Lift f a -> Lift f b Source #(.>) :: Lift f a -> Lift f b -> Lift f b Source #(<.) :: Lift f a -> Lift f b -> Lift f a Source # (Functor m, Monad m) => Apply (MaybeT m) Source # Methods(<.>) :: MaybeT m (a -> b) -> MaybeT m a -> MaybeT m b Source #(.>) :: MaybeT m a -> MaybeT m b -> MaybeT m b Source #(<.) :: MaybeT m a -> MaybeT m b -> MaybeT m a Source # Apply m => Apply (ListT m) Source # Methods(<.>) :: ListT m (a -> b) -> ListT m a -> ListT m b Source #(.>) :: ListT m a -> ListT m b -> ListT m b Source #(<.) :: ListT m a -> ListT m b -> ListT m a Source # Apply f => Apply (MaybeApply f) Source # Methods(<.>) :: MaybeApply f (a -> b) -> MaybeApply f a -> MaybeApply f b Source #(.>) :: MaybeApply f a -> MaybeApply f b -> MaybeApply f b Source #(<.) :: MaybeApply f a -> MaybeApply f b -> MaybeApply f a Source # Source # Methods(<.>) :: WrappedApplicative f (a -> b) -> WrappedApplicative f a -> WrappedApplicative f b Source #(.>) :: WrappedApplicative f a -> WrappedApplicative f b -> WrappedApplicative f b Source #(<.) :: WrappedApplicative f a -> WrappedApplicative f b -> WrappedApplicative f a Source # Arrow a => Apply (WrappedArrow a b) Source # Methods(<.>) :: WrappedArrow a b (a -> b) -> WrappedArrow a b a -> WrappedArrow a b b Source #(.>) :: WrappedArrow a b a -> WrappedArrow a b b -> WrappedArrow a b b Source #(<.) :: WrappedArrow a b a -> WrappedArrow a b b -> WrappedArrow a b a Source # Semigroup m => Apply (Const * m) Source # Methods(<.>) :: Const * m (a -> b) -> Const * m a -> Const * m b Source #(.>) :: Const * m a -> Const * m b -> Const * m b Source #(<.) :: Const * m a -> Const * m b -> Const * m a Source # Biapply p => Apply (Join * p) Source # Methods(<.>) :: Join * p (a -> b) -> Join * p a -> Join * p b Source #(.>) :: Join * p a -> Join * p b -> Join * p b Source #(<.) :: Join * p a -> Join * p b -> Join * p a Source # Apply w => Apply (TracedT m w) Source # 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 # (Apply w, Semigroup s) => Apply (StoreT s w) Source # 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 # (Semigroup e, Apply w) => Apply (EnvT e w) Source # 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 # Apply (Cokleisli w a) Source # Methods(<.>) :: Cokleisli w a (a -> b) -> Cokleisli w a a -> Cokleisli w a b Source #(.>) :: Cokleisli w a a -> Cokleisli w a b -> Cokleisli w a b Source #(<.) :: Cokleisli w a a -> Cokleisli w a b -> Cokleisli w a a Source # Apply w => Apply (IdentityT * w) Source # 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 # Apply f => Apply (Reverse * f) Source # Methods(<.>) :: Reverse * f (a -> b) -> Reverse * f a -> Reverse * f b Source #(.>) :: Reverse * f a -> Reverse * f b -> Reverse * f b Source #(<.) :: Reverse * f a -> Reverse * f b -> Reverse * f a Source # Apply f => Apply (Backwards * f) Source # Methods(<.>) :: Backwards * f (a -> b) -> Backwards * f a -> Backwards * f b Source #(.>) :: Backwards * f a -> Backwards * f b -> Backwards * f b Source #(<.) :: Backwards * f a -> Backwards * f b -> Backwards * f a Source # (Apply m, Semigroup w) => Apply (WriterT w m) Source # Methods(<.>) :: WriterT w m (a -> b) -> WriterT w m a -> WriterT w m b Source #(.>) :: WriterT w m a -> WriterT w m b -> WriterT w m b Source #(<.) :: WriterT w m a -> WriterT w m b -> WriterT w m a Source # (Apply m, Semigroup w) => Apply (WriterT w m) Source # Methods(<.>) :: WriterT w m (a -> b) -> WriterT w m a -> WriterT w m b Source #(.>) :: WriterT w m a -> WriterT w m b -> WriterT w m b Source #(<.) :: WriterT w m a -> WriterT w m b -> WriterT w m a Source # Bind m => Apply (StateT s m) Source # Methods(<.>) :: StateT s m (a -> b) -> StateT s m a -> StateT s m b Source #(.>) :: StateT s m a -> StateT s m b -> StateT s m b Source #(<.) :: StateT s m a -> StateT s m b -> StateT s m a Source # Bind m => Apply (StateT s m) Source # Methods(<.>) :: StateT s m (a -> b) -> StateT s m a -> StateT s m b Source #(.>) :: StateT s m a -> StateT s m b -> StateT s m b Source #(<.) :: StateT s m a -> StateT s m b -> StateT s m a Source # (Functor m, Monad m) => Apply (ErrorT e m) Source # Methods(<.>) :: ErrorT e m (a -> b) -> ErrorT e m a -> ErrorT e m b Source #(.>) :: ErrorT e m a -> ErrorT e m b -> ErrorT e m b Source #(<.) :: ErrorT e m a -> ErrorT e m b -> ErrorT e m a Source # (Functor m, Monad m) => Apply (ExceptT e m) Source # Methods(<.>) :: ExceptT e m (a -> b) -> ExceptT e m a -> ExceptT e m b Source #(.>) :: ExceptT e m a -> ExceptT e m b -> ExceptT e m b Source #(<.) :: ExceptT e m a -> ExceptT e m b -> ExceptT e m a Source # Semigroup f => Apply (Constant * f) Source # Methods(<.>) :: Constant * f (a -> b) -> Constant * f a -> Constant * f b Source #(.>) :: Constant * f a -> Constant * f b -> Constant * f b Source #(<.) :: Constant * f a -> Constant * f b -> Constant * f a Source # Apply f => Apply (Static f a) Source # Methods(<.>) :: Static f a (a -> b) -> Static f a a -> Static f a b Source #(.>) :: Static f a a -> Static f a b -> Static f a b Source #(<.) :: Static f a a -> Static f a b -> Static f a a Source # (Apply f, Apply g) => Apply (Product * f g) Source # Methods(<.>) :: Product * f g (a -> b) -> Product * f g a -> Product * f g b Source #(.>) :: Product * f g a -> Product * f g b -> Product * f g b Source #(<.) :: Product * f g a -> Product * f g b -> Product * f g a Source # Apply m => Apply (ReaderT * e m) Source # Methods(<.>) :: ReaderT * e m (a -> b) -> ReaderT * e m a -> ReaderT * e m b Source #(.>) :: ReaderT * e m a -> ReaderT * e m b -> ReaderT * e m b Source #(<.) :: ReaderT * e m a -> ReaderT * e m b -> ReaderT * e m a Source # Apply (ContT * r m) Source # Methods(<.>) :: ContT * r m (a -> b) -> ContT * r m a -> ContT * r m b Source #(.>) :: ContT * r m a -> ContT * r m b -> ContT * r m b Source #(<.) :: ContT * r m a -> ContT * r m b -> ContT * r m a Source # (Apply f, Apply g) => Apply (Compose * * f g) Source # Methods(<.>) :: Compose * * f g (a -> b) -> Compose * * f g a -> Compose * * f g b Source #(.>) :: Compose * * f g a -> Compose * * f g b -> Compose * * f g b Source #(<.) :: Compose * * f g a -> Compose * * f g b -> Compose * * f g a Source # (Bind m, Semigroup w) => Apply (RWST r w s m) Source # Methods(<.>) :: RWST r w s m (a -> b) -> RWST r w s m a -> RWST r w s m b Source #(.>) :: RWST r w s m a -> RWST r w s m b -> RWST r w s m b Source #(<.) :: RWST r w s m a -> RWST r w s m b -> RWST r w s m a Source # (Bind m, Semigroup w) => Apply (RWST r w s m) Source # Methods(<.>) :: RWST r w s m (a -> b) -> RWST r w s m a -> RWST r w s m b Source #(.>) :: RWST r w s m a -> RWST r w s m b -> RWST r w s m b Source #(<.) :: RWST r w s m a -> RWST r w s m b -> RWST r w s m a Source # (<..>) :: Apply w => w a -> w (a -> b) -> w b infixl 4 Source # A variant of <.> with the arguments reversed. liftF2 :: Apply w => (a -> b -> c) -> w a -> w b -> w c Source # Lift a binary function into a comonad with zipping liftF3 :: Apply w => (a -> b -> c -> d) -> w a -> w b -> w c -> w d Source # Lift a ternary function into a comonad with zipping # Wrappers newtype WrappedApplicative f a Source # Wrap an Applicative to be used as a member of Apply Constructors  WrapApplicative FieldsunwrapApplicative :: f a Instances  Source # Methodsfmap :: (a -> b) -> WrappedApplicative f a -> WrappedApplicative f b #(<$) :: a -> WrappedApplicative f b -> WrappedApplicative f a # Source # Methodspure :: a -> WrappedApplicative f a #(<*>) :: WrappedApplicative f (a -> b) -> WrappedApplicative f a -> WrappedApplicative f b #(*>) :: WrappedApplicative f a -> WrappedApplicative f b -> WrappedApplicative f b #(<*) :: WrappedApplicative f a -> WrappedApplicative f b -> WrappedApplicative f a # Source # Methods(<|>) :: WrappedApplicative f a -> WrappedApplicative f a -> WrappedApplicative f a #some :: WrappedApplicative f a -> WrappedApplicative f [a] #many :: WrappedApplicative f a -> WrappedApplicative f [a] # Source # Methods(<.>) :: WrappedApplicative f (a -> b) -> WrappedApplicative f a -> WrappedApplicative f b Source #(.>) :: WrappedApplicative f a -> WrappedApplicative f b -> WrappedApplicative f b Source #(<.) :: WrappedApplicative f a -> WrappedApplicative f b -> WrappedApplicative f a Source # Source # Methods() :: WrappedApplicative f a -> WrappedApplicative f a -> WrappedApplicative f a Source #some :: Applicative (WrappedApplicative f) => WrappedApplicative f a -> WrappedApplicative f [a] Source #many :: Applicative (WrappedApplicative f) => WrappedApplicative f a -> WrappedApplicative f [a] Source # Source # Methods

newtype MaybeApply f a Source #

Transform a Apply into an Applicative by adding a unit.

Constructors

 MaybeApply FieldsrunMaybeApply :: Either (f a) a

Instances

 Functor f => Functor (MaybeApply f) Source # Methodsfmap :: (a -> b) -> MaybeApply f a -> MaybeApply f b #(<\$) :: a -> MaybeApply f b -> MaybeApply f a # Apply f => Applicative (MaybeApply f) Source # Methodspure :: a -> MaybeApply f a #(<*>) :: MaybeApply f (a -> b) -> MaybeApply f a -> MaybeApply f b #(*>) :: MaybeApply f a -> MaybeApply f b -> MaybeApply f b #(<*) :: MaybeApply f a -> MaybeApply f b -> MaybeApply f a # Comonad f => Comonad (MaybeApply f) Source # Methodsextract :: MaybeApply f a -> a #duplicate :: MaybeApply f a -> MaybeApply f (MaybeApply f a) #extend :: (MaybeApply f a -> b) -> MaybeApply f a -> MaybeApply f b # Extend f => Extend (MaybeApply f) Source # Methodsduplicated :: MaybeApply f a -> MaybeApply f (MaybeApply f a) Source #extended :: (MaybeApply f a -> b) -> MaybeApply f a -> MaybeApply f b Source # Apply f => Apply (MaybeApply f) Source # Methods(<.>) :: MaybeApply f (a -> b) -> MaybeApply f a -> MaybeApply f b Source #(.>) :: MaybeApply f a -> MaybeApply f b -> MaybeApply f b Source #(<.) :: MaybeApply f a -> MaybeApply f b -> MaybeApply f a Source #