Monoidal vs applicative - Haskell

Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.

James Sully

The docs for Control.Invertible.Monoidal say

Invariant monoidal functor. This roughly corresponds to Applicative, [..]

What's rough about the correspondence, if anything?

Fintan Halpenny

I think what they're referring to is that the module's contents roughly correspond to the contents of Control.Applicative

Fintan Halpenny

Oh wait there's two places they talk about correspondence, whoops! Reading that part now

Fintan Halpenny

So you could define Applicative in terms of Monoidal I'm pretty sure.

Fintan Halpenny

You should try give it a go defining pure and <*> in terms of unit and >*<

Vladimir Ciobanu

I think they are actually exactly equivalent, not only "roughly correspondent", but the Applicative interface is nicer to work with, in practice.


It's basically the same thing as relation between

bind :: Monad m => m a -> (a -> m b) -> m b


join :: Monad m => m (m a) -> m a

One is more convenient, the other is closer to formal definition