From f7a10e0e57d6f0ea83643c3d5763ff405af73337 Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Wed, 28 Sep 2016 13:44:04 -0400 Subject: Formatting pass --- .../java/bjc/utils/funcdata/theory/Bifunctor.java | 48 ++++++++++++++-------- .../java/bjc/utils/funcdata/theory/Functor.java | 6 ++- 2 files changed, 35 insertions(+), 19 deletions(-) (limited to 'BJC-Utils2/src/main/java/bjc/utils/funcdata/theory') diff --git a/BJC-Utils2/src/main/java/bjc/utils/funcdata/theory/Bifunctor.java b/BJC-Utils2/src/main/java/bjc/utils/funcdata/theory/Bifunctor.java index d3ebdac..a8f27c6 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/funcdata/theory/Bifunctor.java +++ b/BJC-Utils2/src/main/java/bjc/utils/funcdata/theory/Bifunctor.java @@ -31,21 +31,31 @@ public interface Bifunctor { * The function that maps over the right of the pair * @return A function that maps over both parts of the pair */ - public default Function, Bifunctor> bimap( - Function leftFunc, - Function rightFunc) { - Function, Bifunctor> bimappedFunc = ( - argPair) -> { - Function, Bifunctor> leftMapper = argPair - . fmapLeft(leftFunc); + public default Function, + Bifunctor> bimap( + Function leftFunc, + Function rightFunc) { + Function, + Bifunctor> bimappedFunc = (argPair) -> { + Function, + Bifunctor> leftMapper = argPair.< + OldLeft, OldRight, + NewLeft> fmapLeft(leftFunc); - Bifunctor leftMappedFunctor = leftMapper - .apply(argPair); - Function, Bifunctor> rightMapper = leftMappedFunctor - . fmapRight(rightFunc); + Bifunctor leftMappedFunctor = leftMapper + .apply(argPair); + Function, + Bifunctor> rightMapper = leftMappedFunctor + . fmapRight( + rightFunc); - return rightMapper.apply(leftMappedFunctor); - }; + return rightMapper.apply(leftMappedFunctor); + }; return bimappedFunc; } @@ -64,8 +74,10 @@ public interface Bifunctor { * pair * @return The function lifted to work over the left side of bifunctors */ - public Function, Bifunctor> fmapLeft( - Function func); + public Function, + Bifunctor> fmapLeft( + Function func); /** * Lift a function to operate over the right part of this pair @@ -82,8 +94,10 @@ public interface Bifunctor { * @return The function lifted to work over the right side of * bifunctors */ - public Function, Bifunctor> fmapRight( - Function func); + public Function, + Bifunctor> fmapRight( + Function func); /** * Get the value contained on the left of this bifunctor diff --git a/BJC-Utils2/src/main/java/bjc/utils/funcdata/theory/Functor.java b/BJC-Utils2/src/main/java/bjc/utils/funcdata/theory/Functor.java index 76f48e2..10cfffe 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/funcdata/theory/Functor.java +++ b/BJC-Utils2/src/main/java/bjc/utils/funcdata/theory/Functor.java @@ -27,8 +27,10 @@ public interface Functor { * @return The passed in function converted to work over a particular * type of functors */ - public Function, Functor> fmap( - Function func); + public Function, + Functor> fmap( + Function func); /** * Retrieve the thing inside this functor -- cgit v1.2.3