Was it really hard to introduce type variables in Java? Of course I can declare
but shit, I need to have some kind of automatic cast from
abstract class NaturalTransformation extends Pair<YObjects, Map<XObjects, YArrows>> {};
but shit, I need to have some kind of automatic cast from
Pair<YObjects, Map<XObjects, YArrows>>
to NaturalTransformation
to make it work when I apply schwarzian transform... I know, I know, in Scala both tricks are readily available, but I am a stupid old Java programmer, so what can I do? Just switch to Scala and forget the nightmarish things like private Iterable<Pair<YObjects, Map<XObjects, YArrows>>> objectToFunctorTransforms() {
return flatten(new Function<YObjects, Iterable<Pair<YObjects, Map<XObjects, YArrows>>>>() {
// for an object y returns a collections of arrows from y to F(x) for x in this functor's domain,
// such that it is compatible: y -> F(x1) -> F(x2) is in the map too.
public Iterable<Map<XObjects, YArrows>> apply(YObjects y) {
return arrowsFromObject(y);
}
}.schwartzianTransform().map(codomain().objects()));
}
? Maybe, maybe... let me think...