<p>Has anyone thought about what constraints a monad should satisfy in order for its arrows to be able to be &quot;applicativized&quot;. That is, for what monads <span class="math-container">$M$</span> is it the case that there is an injective function <span class="math-container">$\gamma$</span> taking arrows of type <span class="math-container">$a \rightarrow M b$</span> onto values of type <span class="math-container">$M (a \rightarrow b)$</span>, such that for any <span class="math-container">$D : M a$</span> and any <span class="math-container">$p : a \rightarrow M b$</span>,</p>
<p><span class="math-container">$$D \star \lambda x.\gamma(p) \star \lambda f.\eta(f(x))   =   D \star \lambda x. p(x)$$</span></p>
<p>For such a monad, <span class="math-container">$\gamma$</span> would also have the left inverse:</p>
<p><span class="math-container">$$\gamma^L(m) = \lambda x.m \star \lambda f.\eta(f(x))$$</span></p>
<p>One example is the Reader monad (for which you just flip the arguments). In general, this feels like a lot to ask. But I'd wonder if something like the &quot;probability monad&quot; would provide an example - that is, the monad <span class="math-container">$P$</span> such that <span class="math-container">$P \alpha$</span> is the type of probability distributions over values of type <span class="math-container">$\alpha$</span> - and if not, why not.</p>

CC BY-SA 4.0
2024-02-26T08:57:52.260Z
A related question was here: https://stackoverflow.com/questions/39649497/is-this-property-of-a-functor-stronger-than-a-monad/39736535#39736535 and I called those monads "rigid functors". There are several open questions about rigid functors; for instance whether they are all monads or not. One example of a rigid monad M is is $M\, a = F\, a \to a$ where $F$ is any contravariant functor.
winitzki
CC BY-SA 4.0
2024-02-26T09:06:29.607Z
If the type of "probability distributions" is $P\,a = (a\to R)\to a$ where $R$ is the type of real numbers then this $P$ is of the form $F\, a \to a$ with a contravariant $F$ and so it is rigid.
winitzki
CC BY-SA 4.0
2024-02-26T19:41:16.607Z
Thanks. There are at least two ways of representing probability distributions:

(1) $P \alpha = \alpha \rightarrow R$

(2) $P \alpha = (\alpha \rightarrow R) \rightarrow R$ (i.e., via continuations)

Defining bind for (1) is a bit heavy handed, since it requires an integrator for each type.
Julian G.
CC BY-SA 4.0
2024-02-27T09:16:30.347Z
At first sight, $P\, \alpha = \alpha\to R$ is contravariant in $\alpha$ and cannot be a monad. Also, $P\,\alpha = (\alpha\to R)\to R$ is actually not rigid (that is, one can't define your $\gamma$ for it).
winitzki
CC BY-SA 4.0
2024-02-27T20:01:18.227Z
The idea for $P \alpha$ is to define it so that $\eta(v)$ takes v onto 1 and anything else onto 0 if v is discrete and uses the Dirac Delta if it is continuous; meanwhile $m \star k = \lambda y.\int_x m(x)*k(x)(y)$ - this is what I meant above about having to have an integrator for each type. As for the encoding that uses continuations, return and bind are inherited from the continuation monad, but not every inhabitant of some Pα will represent a probability distribution (i.e., satisfy the Kolmogorov axioms). I wonder if this helps.
Julian G.
<monad><applicative>
Monads whose Kleisli arrows can be "applicativized"
Julian G.
# Monads whose Kleisli arrows can be "applicativized"

(Asked by: username_0 on 2024-02-26)

Has anyone thought about what constraints a monad should satisfy in order for its arrows to be able to be "applicativized". That is, for what monads $M$ is it the case that there is an injective function $\gamma$ taking arrows of type $a \rightarrow M b$ onto values of type $M (a \rightarrow b)$, such that for any $D : M a$ and any $p : a \rightarrow M b$,

$$D \star \lambda x.\gamma(p) \star \lambda f.\eta(f(x)) = D \star \lambda x. p(x)$$

For such a monad, $\gamma$ would also have the left inverse:

$$\gamma^L(m) = \lambda x.m \star \lambda f.\eta(f(x))$$

One example is the Reader monad (for which you just flip the arguments). In general, this feels like a lot to ask. But I'd wonder if something like the "probability monad" would provide an example - that is, the monad $P$ such that $P \alpha$ is the type of probability distributions over values of type $\alpha$ - and if not, why not.

**Tags:** monad, applicative

> **Comments:**
> **username_1**: A related question was here: https://stackoverflow.com/questions/39649497/is-this-property-of-a-functor-stronger-than-a-monad/39736535#39736535 and I called those monads "rigid functors". There are several open questions about rigid functors; for instance whether they are all monads or not. One example of a rigid monad M is is $M\, a = F\, a \to a$ where $F$ is any contravariant functor.  
> **username_1**: If the type of "probability distributions" is $P\,a = (a\to R)\to a$ where $R$ is the type of real numbers then this $P$ is of the form $F\, a \to a$ with a contravariant $F$ and so it is rigid.  
> **username_0**: Thanks. There are at least two ways of representing probability distributions:  (1) $P \alpha = \alpha \rightarrow R$  (2) $P \alpha = (\alpha \rightarrow R) \rightarrow R$ (i.e., via continuations)  Defining bind for (1) is a bit heavy handed, since it requires an integrator for each type.  
> **username_1**: At first sight, $P\, \alpha = \alpha\to R$ is contravariant in $\alpha$ and cannot be a monad. Also, $P\,\alpha = (\alpha\to R)\to R$ is actually not rigid (that is, one can't define your $\gamma$ for it).  
> **username_0**: The idea for $P \alpha$ is to define it so that $\eta(v)$ takes v onto 1 and anything else onto 0 if v is discrete and uses the Dirac Delta if it is continuous; meanwhile $m \star k = \lambda y.\int_x m(x)*k(x)(y)$ - this is what I meant above about having to have an integrator for each type. As for the encoding that uses continuations, return and bind are inherited from the continuation monad, but not every inhabitant of some Pα will represent a probability distribution (i.e., satisfy the Kolmogorov axioms). I wonder if this helps.  

---

## 0 answers

