1

I know >>= determines the Kleisli composition operator >=> (as explained here), but does it ever arise in mathematics per se.

JRC
  • 167
  • 6
  • Maybe the Kleisli apply operator? :-) – freestyle Nov 02 '20 at 15:17
  • 3
    Not that I'm aware of. In category theory, a monad is defined by `return` and `join`, and `>>=` is just a combination of `fmap` and `join` (`m >>= f = join (fmap f m)`). That is, `>>=` isn't "interesting" mathematically, but rather an operational short cut in programming. – chepner Nov 02 '20 at 15:19
  • 2
    In Moggi's 1991 *Notions of computations and monads* he uses `f*` to what we'd write in Haskell as `(f =< – Will Ness Nov 02 '20 at 15:58

1 Answers1

3

>>=, unlike join, doesn't really make sense in a general monad – i.e., in a monad in a category about which you don't know anything further.

Specifically, >>= assumes that you have values in the category (the m a left-hand side), but a general category has no such notion – only arrows are required, the objects (which in Haskell are value-containing types) are opaque. So if anything, you should consider the flipped version

(=<<) :: (a -> m b) -> (m a -> m b)

which according to Will Ness' comment indeed features in Notions of computations and monads.

Where you can have values is in a well-pointed category, where you can express values by arrows from the terminal object, i.e. in Hask that's functions () -> a. With that, the operator to consider would be

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

I doubt this has been considered as such in the mathematical literature.

leftaroundabout
  • 111,176
  • 4
  • 161
  • 301