Applicative Instance for (Monad m, Monoid o) => m o?
By : A. Gonzalez
Date : March 29 2020, 07:55 AM
Does that help You want the Constant applicative from Data.Functor.Constant in the transformers package, which you can find here. This Applicative has the following instance: code :
instance (Monoid a) => Applicative (Constant a) where
pure _ = Constant mempty
Constant x <*> Constant y = Constant (x `mappend` y)
instance (Applicative f, Applicative g) => Applicative (Compose f g) where
pure x = Compose (pure (pure x))
Compose f <*> Compose x = Compose ((<*>) <$> f <*> x)

How to add applicative effects to a monoid?
By : Yatendra Dohare
Date : March 29 2020, 07:55 AM
wish help you to fix your issue How can I change following code so that each element in Maybe monoid element takes also two arguments (so it would become "double" reader applicative)? , This is how I would do it code :
g2 x y = g $ ($ y) <$> ($ x) <$> theList

How are monoid and applicative connected?
By : Christian Jungers
Date : March 29 2020, 07:55 AM
help you fix your problem Remark: I don't own the book (yet), and IIRC, at least one of the authors is active on SO and should be able to answer this question. That being said, the idea behind a monoid (or rather a semigroup) is that you have a way to create another object from two objects in that monoid1: code :
mappend :: Monoid m => m > m > m
amappend :: f (a > b) > f a > f b
amappend :: f > f > f
fmap :: (a > b) > f a > f b
 ^
 no f here
($) :: (a > b) > a > b
(<*>) :: f (a > b) > f a > f b
increase :: Int > Int
increase x = x + 1
five :: Int
five = 5
increaseA :: Applicative f => f (Int > Int)
increaseA = pure increase
fiveA :: Applicative f => f Int
fiveA = pure 5
normalIncrease = increase $ five
applicativeIncrease = increaseA <*> fiveA

Monoidal Functor is Applicative but where is the Monoid typeclass in the definition of Applicative?
By : coderax
Date : March 29 2020, 07:55 AM
Any of those help The monoid that's referred to with “monoidal functor” is not a Monoid monoid, i.e. a valuelevel monoid. It's a typelevel monoid instead. Namely, the boring product monoid code :
type Mempty = ()
type a <> b = (a,b)
class Functor f => Monoidal f where
pureUnit :: f Mempty
fzip :: f a > f b > f (a<>b)
 an even more “general nonsense”, equivalent formulation is
 upure :: Mempty > f Mempty
 fzipt :: (f a<>f b) > f (a<>b)
 i.e. the functor maps a monoid to a monoid (in this case the same monoid).
 That's really the mathematical idea behind this all.
class Functor f => Monoidal f where
pureUnit :: f ()
fzip :: f a > f b > f (a,b)
instance Monoid a => Monoidal ((,) a) where
pureUnit = (mempty, ())
fzip (p,a) (q,b) = (p<>q, (a,b))

How can Monoid r => Const r of the optic Fold type be generalized to Contravariant + Applicative?
By : user3078291
Date : March 29 2020, 07:55 AM

