top | item 37214617

(no title)

MaxRegret | 2 years ago

I agree that it would be interesting to learn what non-strong monads look like. But the blog post does (implicitly) answer some of your questions:

It says that all monads in the Set category are strong. That would include Haskell monads, at least those expressed in the usual way as type constructors, to the extent that Haskell types model sets.

And you can see that the "strength" operation relies on the existence of tuples behaving like Cartesian products of sets. Such objects might not exist in other categories.

discuss

order

consilient|2 years ago

> I agree that it would be interesting to learn what non-strong monads look like.

A monad is strong if:

- its underlying functor is strong

- the strength commutes with the monad unit `return :: a -> m a`, i.e. `return (x,y) === strength x (return y)`

- the strength commutes with the monad multiplication `join :: m (m a) -> m a`, i.e. `strength x (join mmy) === join (map strength (strength x mmy))`

So a non-strong monad is one for which at least one of these conditions is false.

Non-strong functors are easy to find examples of: take any container type with multiple "slots" (e.g. lists, arrays, n>1-tuples) and put it in a language with linear types. You can't implement `strength` for these types because you can't necessarily copy the `x` value.

Off the top of my head, I can't think of any non-contrived way to violate the latter two conditions without also breaking the monad laws or the requirements of a monoidal product, but presumably they're out there.

throwaway17_17|2 years ago

I don’t think ‘strength’ requires a Cartesian product. I was under the expression that any tensor product was sufficient, some of which lack Cartesian structure.

consilient|2 years ago

You need it to be symmetric if you want strength as such instead of left-strength and right-strength, but otherwise yes, it makes sense to talk about strength relative to any monoidal product.