4 ms·
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
by Littlebigo 5y ago
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)".
- Twisol 5y agoI 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] [0] https://typelevel.org/cats/typeclasses/functor.html https://typelevel.org/cats/typeclasses/functor.html
- Littlebigo 5y agoI absolutely agree, I was just adding the explanation for anyone unfamiliar with the syntax.
- Twisol 5y agoAnd I was building on yours :) I hope you didn't mind.