Re:Monads are monoids in the category of endofunctors
by Littlebigo on Thursday September 09, 2021 @10:34PM
(#28477148)
To add, I suspect that the Haskell type notation is not intuitive to people not familiar with it. For anyone wondering, (a -> b) -> f a -> f b means "A function taking a function from one type to another "(a -> b)" and a functor applied with one type "(f a)" and returns a functor applied with another type "(f b)".
[ Parent
| on HN ]
Re:Monads are monoids in the category of endofunctors
by Twisol on Thursday September 09, 2021 @11:07PM
(#28477352)
I do think familiarity plays a big role. I find the Haskell syntax much more pleasant than Java, even though I'm perfectly familiar with both.
The equivalent signature in Java (if we could abstract over type functions) would be:
interface Functor<F<_>> {
<A, B> Function<F<A>, F<B>> map(Function<A, B> f);
}
You'll find very similar in Scala's `cats`, up to some currying and reordering. [0]
Re:Monads are monoids in the category of endofunctors
by Littlebigo on Thursday September 09, 2021 @11:15PM
(#28477410)
I absolutely agree, I was just adding the explanation for anyone unfamiliar with the syntax.