News for hackers. Stuff that matters.
Re:Monads are monoids in the category of endofunctors by Twisol on Thursday September 09, 2021 @09:33PM (#28476808)
In particular, a functor is a type constructor F together with a higher-order function deriving transformations `F T -> F S` given a transformation `T -> S`, subject to some semantic requirements. This is the `map` or `fmap` people refer to as defining the functor.

Unfortunately, due to abuse of notation, the type constructor isn't given much focus. But it's true that "type constructor" is the first conceptual hurdle.

Re:Monads are monoids in the category of endofunctors by catgary on Thursday September 09, 2021 @09:36PM (#28476824)
Type constructor that lifts to functions is even a pretty intuitive (ahistorical) intuition for “functor”.
Re:Monads are monoids in the category of endofunctors by 6nf on Thursday September 09, 2021 @09:35PM (#28476822)
See this is exactly the point where FP fans lose the rest of us.
Re:Monads are monoids in the category of endofunctors by Twisol on Thursday September 09, 2021 @09:44PM (#28476874)
You asked. I'm happy to dissect it to your level, but I don't know what you may be familiar with, and if you're not comfortable with type functions, I'm going to have a hard time motivating the extra bits a functor has.

The List functor is a combination of the type function sending `T` to `List<T>` and the ... what do you want me to call it, a function function? implemented in Java as:

    static <T, S> Function<List<T>, List<S>> map(Function<T, S> f) {
      return (ts) -> {
        var ss = new ArrayList<S>();
        for (final var t : ts) ss.add(f.apply(t));
        return ss;
      };
    }
We call it as map(f).apply(ts). If we want to pass them both at once, we can rewrite the function so that it's not static, but it doesn't much change that it's a mapping operation.

But it's not the `map` method that's the important part, so much as the idea that we can (or want to; can't in Java) pass `List` to any function that needs a Functor, which can then use whatever `map` implementation that functor has, without knowing what actual type function it was given.

Really, I suspect it's neither the type constructor nor the map function that's the conceptual hurdle. It's abstracting over the type constructor; taking a type constructor as a parameter. You may have never used a language that supports that, or seen a need for it, and this may all seem like needless sophistry until you do.

Re:Monads are monoids in the category of endofunctors by catgary on Thursday September 09, 2021 @09:37PM (#28476832)
It’s a type constructor that extends to functions. It’s a functor.