Boost logo

Boost :

Subject: Re: [boost] [GSoC] [Boost.Hana] Formal review request
From: Louis Dionne (ldionne.2_at_[hidden])
Date: 2014-07-31 09:27:26

Bjorn Reese <breese <at>> writes:

> On 07/30/2014 11:53 PM, Louis Dionne wrote:
> > I agree that `bind` isn't a good choice. I'll think of something, but `apply`
> > and `compute` are out of question because Monads are not computations; that's
> > just one metaphor.
> I do not associate 'apply' with computation. The documentation of
> hana::bind states that it "Appl[ies] a function returning a monad to
> the value(s) inside a monad", so 'apply' does not seem like such a bad
> name.

`apply` is already used for the same purpose as in the MPL:
    apply(f, args...) == f(args...)

Furthermore, `bind` is used as follows:
    bind(bind(bind(monad, monadic_f), monadic_g), monadic_h)

For it to be named `apply`, I'd at least have to reverse the order of the
arguments so we can say "apply a monadic function to a monad". I'll think
about another name for `bind` but I'm really not sure `apply` is better


Oh and I just thought about that, but `ap` is also used to apply a function
inside an applicative to arguments inside applicatives. So I'm even less sure
about `apply` for Monads, since Monads are Applicatives. So you'd have

    ap(function_inside_monad, argument_inside_monad)
    apply(function_returning_a_monad, argument_inside_monad)

and I think we're in for some confusion if we go with that.


Boost list run by bdawes at, gregod at, cpdaniel at, john at