2525 *
2626 * @version %build.number%
2727 */
28- public abstract class F2 <A , B , C > {
28+ public interface F2 <A , B , C > {
2929 /**
3030 * Transform <code>A</code> and <code>B</code> to <code>C</code>.
3131 *
3232 * @param a The <code>A</code> to transform.
3333 * @param b The <code>B</code> to transform.
3434 * @return The result of the transformation.
3535 */
36- public abstract C f (A a , B b );
36+ public C f (A a , B b );
3737
3838
3939 /**
@@ -42,7 +42,7 @@ public abstract class F2<A, B, C> {
4242 * @param a The <code>A</code> to which to apply this function.
4343 * @return The function partially applied to the given argument.
4444 */
45- public final F <B , C > f (final A a ) {
45+ default public F <B , C > f (final A a ) {
4646 return new F <B , C >() {
4747 public C f (final B b ) {
4848 return F2 .this .f (a , b );
@@ -55,7 +55,7 @@ public C f(final B b) {
5555 *
5656 * @return a wrapped function of arity-1 that returns another wrapped function.
5757 */
58- public final F <A , F <B , C >> curry () {
58+ default public F <A , F <B , C >> curry () {
5959 return new F <A , F <B , C >>() {
6060 public F <B , C > f (final A a ) {
6161 return new F <B , C >() {
@@ -72,7 +72,7 @@ public C f(final B b) {
7272 *
7373 * @return A new function with the arguments of this function flipped.
7474 */
75- public final F2 <B , A , C > flip () {
75+ default public F2 <B , A , C > flip () {
7676 return new F2 <B , A , C >() {
7777 public C f (final B b , final A a ) {
7878 return F2 .this .f (a , b );
@@ -85,7 +85,7 @@ public C f(final B b, final A a) {
8585 *
8686 * @return A new function that calls this function with the elements of a given tuple.
8787 */
88- public final F <P2 <A , B >, C > tuple () {
88+ default public F <P2 <A , B >, C > tuple () {
8989 return new F <P2 <A , B >, C >() {
9090 public C f (final P2 <A , B > p ) {
9191 return F2 .this .f (p ._1 (), p ._2 ());
@@ -98,7 +98,7 @@ public C f(final P2<A, B> p) {
9898 *
9999 * @return This function promoted to transform Arrays.
100100 */
101- public final F2 <Array <A >, Array <B >, Array <C >> arrayM () {
101+ default public F2 <Array <A >, Array <B >, Array <C >> arrayM () {
102102 return new F2 <Array <A >, Array <B >, Array <C >>() {
103103 public Array <C > f (final Array <A > a , final Array <B > b ) {
104104 return a .bind (b , F2 .this .curry ());
@@ -111,7 +111,7 @@ public Array<C> f(final Array<A> a, final Array<B> b) {
111111 *
112112 * @return This function promoted to transform Promises.
113113 */
114- public final F2 <Promise <A >, Promise <B >, Promise <C >> promiseM () {
114+ default public F2 <Promise <A >, Promise <B >, Promise <C >> promiseM () {
115115 return new F2 <Promise <A >, Promise <B >, Promise <C >>() {
116116 public Promise <C > f (final Promise <A > a , final Promise <B > b ) {
117117 return a .bind (b , F2 .this .curry ());
@@ -124,7 +124,7 @@ public Promise<C> f(final Promise<A> a, final Promise<B> b) {
124124 *
125125 * @return This function promoted to transform Iterables.
126126 */
127- public final F2 <Iterable <A >, Iterable <B >, IterableW <C >> iterableM () {
127+ default public F2 <Iterable <A >, Iterable <B >, IterableW <C >> iterableM () {
128128 return new F2 <Iterable <A >, Iterable <B >, IterableW <C >>() {
129129 public IterableW <C > f (final Iterable <A > a , final Iterable <B > b ) {
130130 return IterableW .liftM2 (F2 .this .curry ()).f (a ).f (b );
@@ -137,7 +137,7 @@ public IterableW<C> f(final Iterable<A> a, final Iterable<B> b) {
137137 *
138138 * @return This function promoted to transform Lists.
139139 */
140- public final F2 <List <A >, List <B >, List <C >> listM () {
140+ default public F2 <List <A >, List <B >, List <C >> listM () {
141141 return new F2 <List <A >, List <B >, List <C >>() {
142142 public List <C > f (final List <A > a , final List <B > b ) {
143143 return List .liftM2 (F2 .this .curry ()).f (a ).f (b );
@@ -150,7 +150,7 @@ public List<C> f(final List<A> a, final List<B> b) {
150150 *
151151 * @return This function promoted to transform non-empty lists.
152152 */
153- public final F2 <NonEmptyList <A >, NonEmptyList <B >, NonEmptyList <C >> nelM () {
153+ default public F2 <NonEmptyList <A >, NonEmptyList <B >, NonEmptyList <C >> nelM () {
154154 return new F2 <NonEmptyList <A >, NonEmptyList <B >, NonEmptyList <C >>() {
155155 public NonEmptyList <C > f (final NonEmptyList <A > as , final NonEmptyList <B > bs ) {
156156 return NonEmptyList .fromList (as .toList ().bind (bs .toList (), F2 .this )).some ();
@@ -163,7 +163,7 @@ public NonEmptyList<C> f(final NonEmptyList<A> as, final NonEmptyList<B> bs) {
163163 *
164164 * @return This function promoted to transform Options.
165165 */
166- public final F2 <Option <A >, Option <B >, Option <C >> optionM () {
166+ default public F2 <Option <A >, Option <B >, Option <C >> optionM () {
167167 return new F2 <Option <A >, Option <B >, Option <C >>() {
168168 public Option <C > f (final Option <A > a , final Option <B > b ) {
169169 return Option .liftM2 (F2 .this .curry ()).f (a ).f (b );
@@ -177,7 +177,7 @@ public Option<C> f(final Option<A> a, final Option<B> b) {
177177 * @param o An ordering for the result of the promoted function.
178178 * @return This function promoted to transform Sets.
179179 */
180- public final F2 <Set <A >, Set <B >, Set <C >> setM (final Ord <C > o ) {
180+ default public F2 <Set <A >, Set <B >, Set <C >> setM (final Ord <C > o ) {
181181 return new F2 <Set <A >, Set <B >, Set <C >>() {
182182 public Set <C > f (final Set <A > as , final Set <B > bs ) {
183183 Set <C > cs = Set .empty (o );
@@ -194,7 +194,7 @@ public Set<C> f(final Set<A> as, final Set<B> bs) {
194194 *
195195 * @return This function promoted to transform Streams.
196196 */
197- public final F2 <Stream <A >, Stream <B >, Stream <C >> streamM () {
197+ default public F2 <Stream <A >, Stream <B >, Stream <C >> streamM () {
198198 return new F2 <Stream <A >, Stream <B >, Stream <C >>() {
199199 public Stream <C > f (final Stream <A > as , final Stream <B > bs ) {
200200 return as .bind (bs , F2 .this );
@@ -207,7 +207,7 @@ public Stream<C> f(final Stream<A> as, final Stream<B> bs) {
207207 *
208208 * @return This function promoted to transform Trees.
209209 */
210- public final F2 <Tree <A >, Tree <B >, Tree <C >> treeM () {
210+ default public F2 <Tree <A >, Tree <B >, Tree <C >> treeM () {
211211 return new F2 <Tree <A >, Tree <B >, Tree <C >>() {
212212 public Tree <C > f (final Tree <A > as , final Tree <B > bs ) {
213213 final F2 <Tree <A >, Tree <B >, Tree <C >> self = this ;
@@ -225,7 +225,7 @@ public Stream<Tree<C>> _1() {
225225 *
226226 * @return A function that zips two arrays with this function.
227227 */
228- public final F2 <Array <A >, Array <B >, Array <C >> zipArrayM () {
228+ default public F2 <Array <A >, Array <B >, Array <C >> zipArrayM () {
229229 return new F2 <Array <A >, Array <B >, Array <C >>() {
230230 public Array <C > f (final Array <A > as , final Array <B > bs ) {
231231 return as .zipWith (bs , F2 .this );
@@ -238,7 +238,7 @@ public Array<C> f(final Array<A> as, final Array<B> bs) {
238238 *
239239 * @return A function that zips two iterables with this function.
240240 */
241- public final F2 <Iterable <A >, Iterable <B >, Iterable <C >> zipIterableM () {
241+ default public F2 <Iterable <A >, Iterable <B >, Iterable <C >> zipIterableM () {
242242 return new F2 <Iterable <A >, Iterable <B >, Iterable <C >>() {
243243 public Iterable <C > f (final Iterable <A > as , final Iterable <B > bs ) {
244244 return wrap (as ).zipWith (bs , F2 .this );
@@ -251,7 +251,7 @@ public Iterable<C> f(final Iterable<A> as, final Iterable<B> bs) {
251251 *
252252 * @return A function that zips two lists with this function.
253253 */
254- public final F2 <List <A >, List <B >, List <C >> zipListM () {
254+ default public F2 <List <A >, List <B >, List <C >> zipListM () {
255255 return new F2 <List <A >, List <B >, List <C >>() {
256256 public List <C > f (final List <A > as , final List <B > bs ) {
257257 return as .zipWith (bs , F2 .this );
@@ -265,7 +265,7 @@ public List<C> f(final List<A> as, final List<B> bs) {
265265 *
266266 * @return A function that zips two streams with this function.
267267 */
268- public final F2 <Stream <A >, Stream <B >, Stream <C >> zipStreamM () {
268+ default public F2 <Stream <A >, Stream <B >, Stream <C >> zipStreamM () {
269269 return new F2 <Stream <A >, Stream <B >, Stream <C >>() {
270270 public Stream <C > f (final Stream <A > as , final Stream <B > bs ) {
271271 return as .zipWith (bs , F2 .this );
@@ -278,7 +278,7 @@ public Stream<C> f(final Stream<A> as, final Stream<B> bs) {
278278 *
279279 * @return A function that zips two non-empty lists with this function.
280280 */
281- public final F2 <NonEmptyList <A >, NonEmptyList <B >, NonEmptyList <C >> zipNelM () {
281+ default public F2 <NonEmptyList <A >, NonEmptyList <B >, NonEmptyList <C >> zipNelM () {
282282 return new F2 <NonEmptyList <A >, NonEmptyList <B >, NonEmptyList <C >>() {
283283 public NonEmptyList <C > f (final NonEmptyList <A > as , final NonEmptyList <B > bs ) {
284284 return NonEmptyList .fromList (as .toList ().zipWith (bs .toList (), F2 .this )).some ();
@@ -292,7 +292,7 @@ public NonEmptyList<C> f(final NonEmptyList<A> as, final NonEmptyList<B> bs) {
292292 * @param o An ordering for the resulting set.
293293 * @return A function that zips two sets with this function.
294294 */
295- public final F2 <Set <A >, Set <B >, Set <C >> zipSetM (final Ord <C > o ) {
295+ default public F2 <Set <A >, Set <B >, Set <C >> zipSetM (final Ord <C > o ) {
296296 return new F2 <Set <A >, Set <B >, Set <C >>() {
297297 public Set <C > f (final Set <A > as , final Set <B > bs ) {
298298 return iterableSet (o , as .toStream ().zipWith (bs .toStream (), F2 .this ));
@@ -306,7 +306,7 @@ public Set<C> f(final Set<A> as, final Set<B> bs) {
306306 *
307307 * @return A function that zips two trees with this function.
308308 */
309- public final F2 <Tree <A >, Tree <B >, Tree <C >> zipTreeM () {
309+ default public F2 <Tree <A >, Tree <B >, Tree <C >> zipTreeM () {
310310 return new F2 <Tree <A >, Tree <B >, Tree <C >>() {
311311 public Tree <C > f (final Tree <A > ta , final Tree <B > tb ) {
312312 final F2 <Tree <A >, Tree <B >, Tree <C >> self = this ;
@@ -325,7 +325,7 @@ public Stream<Tree<C>> _1() {
325325 *
326326 * @return A function that zips two zippers with this function.
327327 */
328- public final F2 <Zipper <A >, Zipper <B >, Zipper <C >> zipZipperM () {
328+ default public F2 <Zipper <A >, Zipper <B >, Zipper <C >> zipZipperM () {
329329 return new F2 <Zipper <A >, Zipper <B >, Zipper <C >>() {
330330 @ SuppressWarnings ({"unchecked" })
331331 public Zipper <C > f (final Zipper <A > ta , final Zipper <B > tb ) {
@@ -341,7 +341,7 @@ public Zipper<C> f(final Zipper<A> ta, final Zipper<B> tb) {
341341 *
342342 * @return A function that zips two TreeZippers with this function.
343343 */
344- public final F2 <TreeZipper <A >, TreeZipper <B >, TreeZipper <C >> zipTreeZipperM () {
344+ default public F2 <TreeZipper <A >, TreeZipper <B >, TreeZipper <C >> zipTreeZipperM () {
345345 return new F2 <TreeZipper <A >, TreeZipper <B >, TreeZipper <C >>() {
346346 @ SuppressWarnings ({"unchecked" })
347347 public TreeZipper <C > f (final TreeZipper <A > ta , final TreeZipper <B > tb ) {
0 commit comments