public static <V, A> Show<fj.data.fingertrees.Node<V, A>> nodeShow(final Show<V> sv, final Show<A> sa) { return show(n -> { final String s = n.match( n2 -> "Node2(" + n2.measure() + " -> " + v2Show(sa).showS(n2.toVector()) + ")", n3 -> "Node3(" + n3.measure() + " -> " + v3Show(sa).showS(n3.toVector()) + ")"); return Stream.fromString(s); }); }
public static <V, A> Show<fj.data.fingertrees.Digit<V, A>> digitShow(final Show<V> sv, final Show<A> sa) { return show(d -> { String s = d.match( o -> "One(" + o.measure() + " -> " + o.value() + ")", two -> "Two(" + two.measure() + " -> " + v2Show(sa).showS(two.values()) + ")", three -> "Three(" + three.measure() + " -> " + v3Show(sa).showS(three.values()) + ")", four -> "Four(" + four.measure() + " -> " + v4Show(sa).showS(four.values()) + ")" ); return Stream.fromString(s); }); }