• onlinepersona@programming.dev
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    I don’t dislike them, I dislike that absolutely terrible explanations given as to what they are.

    “it’s just a function” - oh my, never would’ve guessed. The name gave nothing away.

    “given the definition, one can easily ascertain” - oh, it’s easy, isn’t it? So easy that it’s not even worth mentioning.

    “given $mathematicalDefinition, where $lotsOfOneLetterVariables, $conclusions” - yes yes, totally understood that.

    See haskell wiki, wikipedia, top blog entry #1, top blog entry #2, stackoverflow, LearnYouAHaskell

    You can’t tell me those are good ways of explaining what those are to somebody with little to no mathematical interest. Maybe the concept is easy, maybe. I mean map() is quite easy to understand, but if it were explained as badly as fmap, I guarantee you less people would use it.

    • Nevoic@lemm.ee
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      Most people aren’t practicing teachers, so it makes sense that not all explanations are the best. Trying to get an intuitional understanding of passing by reference or passing by value in imperative languages is arguably more important than understanding how map works, and yet I’d argue it’s also harder to do.

      If you understand map (not just lists, but futures, IOs, Options, Maybes, etc.) then you understand Functors. Yes there are laws, but mathematical laws here are just encoding our intuition. Something like Iterator in Java may not have laws, but you would expect that calling .next() doesn’t modify an SQL database, though it wouldn’t be a technically invalid implementation if it did. The same is not true for Functors. If you map over a List and the act of mapping each int to its double modified a database then you wouldn’t have a lawful functor. But that should make sense intuitionally without knowing the laws.

      People in OO land are more happy to say they “understand” something if they generally get what the abstraction is going for. Do you know all the methods for Iterator/Iterable in Java? Even if you didn’t, you’d likely say you get the “point” of an Iterable. The bar for understanding things in the FP community is usually higher than just understanding the point of something.

      This doesn’t mean FP is more complicated. Actually it kind of means it’s simpler, because it’s not unreasonable for people to totally understand what Functors are for all languages that implement them. The same is not true of Iterable/Iterator. There’s no way you’d have more than just an intuition about what Iterable is in a language you don’t know. I don’t program in Agda or Idris, but I know Functor in those languages are the same as Functor in Scala and Haskell. Same with Monad, Monoids, etc.