15

First of all: Any monad is also an applicative functor and any applicative functor is a functor. This is true in the context of Haskell, but (reading Applicative as "strong lax monoidal functor") not in general, for the rather trivial reason that you can have "applicative" functors between different monoidal categories, whereas monads (and comonads) are ...


8

In this post on SO I found an interesting answer - decisive functors. If we replace () by Void, (,) by Either and reverse the arrows, we get: class Functor f => Decisive f where nogood :: f Void -> Void orwell :: f (Either s t) -> Either (f s) (f t) The blog post also gives some laws that decisive functors adhere to. And, every Comonad is ...


8

MonadPlusDist $\rightarrow$ Alternative is true. Corollary: Alternative $\rightarrow$ MonadPlusCatch is false (because as Petr Pudlák pointed out, [] is a counterexample - it doesn't satisfy MonadPlusCatch but does satisfy MonadPlusDist, hence Applicative) Assumed: MonadPlusDist Laws -- (mplus,mzero) is a monoid mzero >>= k = mzero` ...


6

McBride and Patterson (Section 7) show that an applicative functor, also known as an idiom, is a strong lax monoidal functor. You are looking for a strong colax monoidal functor also known as an strong oplax monoidal functor. As mentioned in a comment, an oplax monoidal functor is a lax monoidal functor between the opposite categories, which ends up being a ...


6

A counter-example for MonadPlusCatch $\rightarrow$ Alternative Indeed it's MaybeT Either: {-# LANGUAGE FlexibleInstances #-} import Control.Applicative import Control.Monad import Control.Monad.Trans.Maybe instance (Show a, Show b) => Show (MaybeT (Either b) a) where showsPrec _ (MaybeT x) = shows x main = print $ let x = id :: Int -&...


1

This is impossible in general. The reason is that the grid-distance is symmetric while being closest neighbors is not a symmetric relation. If you have many points ($\geq 9$) close to the origin and then a point at, say, $(M,0)$ for some large $M$. The point at $(M,0)$ has a its closest neighbors as some of the points which are closest to the origin, but ...


Only top voted, non community-wiki answers of a minimum length are eligible