3 ms·
I think they mean type classes/constructors [1] since they're talking about fmap, though I'm not sure what the proper name is for that concept. What name would
by rovolo 7y ago
I think they mean type classes/constructors [1] since they're talking about fmap, though I'm not sure what the proper name is for that concept. What name would you use?
They're trying to say that Java doesn't support writing a single function like so:
<T<A> extends Iterable<A>, A, B> T<B> fmap(T<A> iterable, Function<A,B> mapper)
I.e. you can't pass ArrayList<A> to a method which takes List<A> and maps to List<B> and know for certain that you get an ArrayList<B> out.
[1] https://en.wikipedia.org/wiki/Type_class#Higher-kinded_polymorphism https://en.wikipedia.org/wiki/Type_class#Higher-kinded_polym...
- hopia 7y agoWell data constructors are a part of algebraic data types which don't really exist in OOP. Unless you consider the class itself (or an interface) or its constructor as the algebraic data type constructor, and its properties/parameters as the values. I'm not so sure fmap would make semantically as much sense in something like Java as it does in FP.