-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #87 from Kevin-Lee/task/86/0-dependency
Close #86 - Make just-semver 0-dependency project
- Loading branch information
Showing
9 changed files
with
72 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package just.semver | ||
|
||
trait Compat { | ||
@SuppressWarnings(Array("org.wartremover.warts.ImplicitConversion")) | ||
implicit def eitherCompat[A, B](either: Either[A, B]): Compat.EitherCompat[A, B] = new Compat.EitherCompat(either) | ||
} | ||
object Compat { | ||
final class EitherCompat[A, B](val either: Either[A, B]) extends AnyVal { | ||
|
||
@inline def map[C](f: B => C): Either[A, C] = | ||
either.right.map(f) | ||
|
||
@inline def flatMap[C >: A, D](f: B => Either[C, D]): Either[C, D] = | ||
either.right.flatMap(f) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package just.semver | ||
|
||
/** | ||
* @author Kevin Lee | ||
* @since 2021-05-28 | ||
*/ | ||
trait Compat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package just.semver | ||
|
||
/** | ||
* @author Kevin Lee | ||
* @since 2021-05-28 | ||
*/ | ||
trait Compat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters