diff options
| author | bculkin2442 <bjculkin@mix.wvu.edu> | 2016-09-28 13:44:04 -0400 |
|---|---|---|
| committer | bculkin2442 <bjculkin@mix.wvu.edu> | 2016-09-28 13:44:04 -0400 |
| commit | f7a10e0e57d6f0ea83643c3d5763ff405af73337 (patch) | |
| tree | 7a56cbf7e5a8b6fa738d2cf469a86eea14d5d89a /BJC-Utils2/src/main/java/bjc/utils/funcdata/theory | |
| parent | ba0a3f53a88842a94ea6a1a6d45f61416b593e47 (diff) | |
Formatting pass
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/funcdata/theory')
| -rw-r--r-- | BJC-Utils2/src/main/java/bjc/utils/funcdata/theory/Bifunctor.java | 48 | ||||
| -rw-r--r-- | BJC-Utils2/src/main/java/bjc/utils/funcdata/theory/Functor.java | 6 |
2 files changed, 35 insertions, 19 deletions
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<LeftType, RightType> { * The function that maps over the right of the pair * @return A function that maps over both parts of the pair */ - public default <OldLeft, OldRight, NewLeft, NewRight> Function<Bifunctor<OldLeft, OldRight>, Bifunctor<NewLeft, NewRight>> bimap( - Function<OldLeft, NewLeft> leftFunc, - Function<OldRight, NewRight> rightFunc) { - Function<Bifunctor<OldLeft, OldRight>, Bifunctor<NewLeft, NewRight>> bimappedFunc = ( - argPair) -> { - Function<Bifunctor<OldLeft, OldRight>, Bifunctor<NewLeft, OldRight>> leftMapper = argPair - .<OldLeft, OldRight, NewLeft> fmapLeft(leftFunc); + public default <OldLeft, OldRight, NewLeft, + NewRight> Function<Bifunctor<OldLeft, OldRight>, + Bifunctor<NewLeft, NewRight>> bimap( + Function<OldLeft, NewLeft> leftFunc, + Function<OldRight, NewRight> rightFunc) { + Function<Bifunctor<OldLeft, OldRight>, + Bifunctor<NewLeft, NewRight>> bimappedFunc = (argPair) -> { + Function<Bifunctor<OldLeft, OldRight>, + Bifunctor<NewLeft, + OldRight>> leftMapper = argPair.< + OldLeft, OldRight, + NewLeft> fmapLeft(leftFunc); - Bifunctor<NewLeft, OldRight> leftMappedFunctor = leftMapper - .apply(argPair); - Function<Bifunctor<NewLeft, OldRight>, Bifunctor<NewLeft, NewRight>> rightMapper = leftMappedFunctor - .<NewLeft, OldRight, NewRight> fmapRight(rightFunc); + Bifunctor<NewLeft, + OldRight> leftMappedFunctor = leftMapper + .apply(argPair); + Function<Bifunctor<NewLeft, OldRight>, + Bifunctor<NewLeft, + NewRight>> rightMapper = leftMappedFunctor + .<NewLeft, OldRight, + NewRight> fmapRight( + rightFunc); - return rightMapper.apply(leftMappedFunctor); - }; + return rightMapper.apply(leftMappedFunctor); + }; return bimappedFunc; } @@ -64,8 +74,10 @@ public interface Bifunctor<LeftType, RightType> { * pair * @return The function lifted to work over the left side of bifunctors */ - public <OldLeft, OldRight, NewLeft> Function<Bifunctor<OldLeft, OldRight>, Bifunctor<NewLeft, OldRight>> fmapLeft( - Function<OldLeft, NewLeft> func); + public <OldLeft, OldRight, + NewLeft> Function<Bifunctor<OldLeft, OldRight>, + Bifunctor<NewLeft, OldRight>> fmapLeft( + Function<OldLeft, NewLeft> func); /** * Lift a function to operate over the right part of this pair @@ -82,8 +94,10 @@ public interface Bifunctor<LeftType, RightType> { * @return The function lifted to work over the right side of * bifunctors */ - public <OldLeft, OldRight, NewRight> Function<Bifunctor<OldLeft, OldRight>, Bifunctor<OldLeft, NewRight>> fmapRight( - Function<OldRight, NewRight> func); + public <OldLeft, OldRight, + NewRight> Function<Bifunctor<OldLeft, OldRight>, + Bifunctor<OldLeft, NewRight>> fmapRight( + Function<OldRight, NewRight> 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<ContainedType> { * @return The passed in function converted to work over a particular * type of functors */ - public <ArgType, ReturnType> Function<Functor<ArgType>, Functor<ReturnType>> fmap( - Function<ArgType, ReturnType> func); + public <ArgType, + ReturnType> Function<Functor<ArgType>, + Functor<ReturnType>> fmap( + Function<ArgType, ReturnType> func); /** * Retrieve the thing inside this functor |
