3 ms·
Adjunctions aren't highly relevant to programming. Monads in programming have much less category theory than monads in math.
by gertef 11y ago
Adjunctions aren't highly relevant to programming. Monads in programming have much less category theory than monads in math.
- Chinjut 11y agoThe significance of monads in programming is entirely because of the adjunction between the category of types and "pure" functions and the category of types and "monadic" functions (i.e., the Kleisli category of the monad). A monad is used to encode the latter in terms of the former via the Kleisli adjunction (whereby monadic maps from FX to FY correspond to pure maps from X to GFY, with the monad GF thus arising from an adjunction F -| G [where F can be taken to be identity on objects in the case of interest]).
- AnimalMuppet 11y agoIf you're going to talk like that, stay far, far away from anyone who is trying to learn monads. I assert that most people coming to Haskell do so because "I hear Haskell and/or FP is cool, I'll try to learn it" rather than "Category theory is so cool, wouldn't it be awesome to program that way". What you said may be true, as the theoretical foundation for why monads are useful, but for someone trying to learn to program in Haskell, what you said is the last thing they need to learn about monads.
- Chinjut 11y agoThat comment of mine wasn't the spiel I'd give to someone first trying to learn about the typical use of monads in a programming context, any more than I'd lecture a beginning programmer on the general theory of commutative rings while introducing integer and floating-point arithmetic (the latter not actually comprising a commutative ring...). But teaching the use of monads to unfamiliar programmers wasn't my goal in that comment. I was just pointing out the accurate response to "Adjunctions aren't highly relevant to programming".
- bassislife 11y agoWhat if one simply says that a monad describes a pattern of morphisms composition ? Adjunctions being the plumbing ? (honest question, just trying to find a simple, grokkable definition)
- AnimalMuppet 11y agoFair enough. There's a place here for technical accuracy all the way down.
- thinkpad20 11y agoI'm not very familiar with category theory and can't really make heads or tails of what you're writing there, but I think the idea behind the statement that "adjunctions aren't highly relevant in programming" is to say that there isn't a huge amount of immediate utility of adjunctions as a programmer. On the other hand, programmers use monads all the time (even if they don't realize it, which is the most common case, as the monad in question is the evaluation of the imperative language they're writing in). Of course, to be honest, I wouldn't know an adjunction from a hole in the ground, so perhaps the same is true for adjunctions -- but I've never heard of them so I'm assuming that's not the case. Either way, what makes monads worth understanding is precisely how useful they are in day-to-day, real-world programming, and in particular understanding how they're used in Haskell is practically essential for understanding almost any extant Haskell code.
- Chinjut 11y agoThe purpose of that comment is to note precisely the same thing applying to adjunctions as you note applying to monads: programmers use adjunctions all the time even if they don't realize it. "I've never heard of them so I'm assuming that's not the case"? Well, hey, most programmers have never heard about monads either. Explicitly having heard of a thing is, by definition, not a requirement for it to be something which one "use[s]... all the time (even if they don't realize it...)". [I'm not saying everyone needs to go out and learn about adjunctions. But they're in exactly the same area as monads in terms of their applicability as a concept to programming. It's weird to consider the one a down-to-earth, comes-up-all-the-time notion and the other some airy-fairy academic construct.]
- muaddirac 11y agoI really appreciate this description. Always nice to see the "actual" definitions instead of "it's like a thing you can map over." I initially had problems understanding monads in Haskell having come from a math perspective.