1. 26

  2. 8

    I really love it. It shows sense for how to bring understanding to people not really interested in a deep dive. It is a very useful explanation even for people that will never pick up Haskell, while still dispelling the idea that there is something particularly hard going on there. No one will pass this comment and later say “Haskell Monads are incredibly hard, everytime I see someone commenting on it, I don’t understand a single word”.

    One question to the avid Monad-Seller, though: How much is the Burrito, eh, Monad?

    1. 1

      people not really interested in a deep dive

      On a tangential note, I seem to be experiencing the Baader-Meinhof phenomenon regarding “deep dive”. Is anyone else?

    2. 6

      I think the code reuse justification is greatly undersold, and it’s been undersold to such an extent that many languages that adopt abstractions like Monad often don’t do it in a way that allows for code reuse. Scala is an example of this, where many classes have a flatMap method, but this method is not implemented as part of any interface. This loses an important benefit of general interfaces like Monad and only leads to further confusion […]

      I think this is a key insight. As someone said “constraints liberate, liberties constrain”.

      In Scala all these types with map, flatMap etc. can’t implement a common interface, because of the different “magic cookies” that all these signatures are burdened with (CanBuildFrom, ExecutionContext, etc.). They allow library authors to do arbitrary things outside of the regular type signatures of map, flatMap, filter, groupBy, but at a very hefty price.

      Enforcing the constraints of Functor, Monad would not only have allowed these different types to have a common API, but would have also ruled out many of the deeply harmful semantics which cripple these APIs today (collection operations building new collections at every tiny step, futures that start running immediately, etc.), guiding library authors toward a design which cleanly separates data, operations and execution instead of conflating these key concerns and forcing library authors to (badly) reinvent the wheel over and over.

      1. 4

        Yeah the rush to FP land and by response people explaining it before they knew what words meant has been a tremendous cost.