It is widely known that Applicative
generalises Arrows
. In the Idioms are oblivious, arrows are meticulous, monads are promiscuous paper by Sam Lindley, Philip Wadler and Jeremy Yallop it is said that Applicative
is equivalent to Static Arrows, that is arrows for which the following isomorphism holds:
arr a b :<->: arr () (a -> b)
As far as I can understand, it could be illustrated the following way:
Note: newtype Identity a = Id { runId :: a }
.
Klesli Identity
is a Static Arrow as it wraps k :: a -> Identity b
. Isomorphism just removes or adds the wrapper.
Kleilsi Maybe
is not a Static Arrow as k = Kleisli (const Nothing)
exists - all f :: a -> b
s correspond to Just . f
, and there is no place for k
in the isomorphism.
But at the same time both Kleisli Identity
and Kleisli Maybe
are Arrow
instances. Therefore, I can not see how the generalisation works.
In Haskell/Understanding Arrows tutorial on Wikibooks they say static morphism and note the following:
Those two concepts are usually known as static arrows and Kleisli arrows respectively. Since using the word "arrow" with two subtly different meanings would make this text horribly confusing, we opted for "morphism", which is a synonym for this alternative meaning.
That is the only lead I have so far - am I confusing Haskell Arrow
and arrows?
So, how does this hierarchy work? How is this Applicative
's property formalised/proven?
Kleisli Maybe
a static arrow in the appropriate category.arr a (Maybe b) :<->: arr () (a -> Maybe b)
. – chepnerarr a (f b)
wheref
is not an endofunctor, I think. You can't define anArrow
that doesn't use Haskell types, so any functor involved would be an endofunctor on Hask. – chepner