Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.rajasharan:java8-easy-monads:-SNAPSHOT'
}
dependencies {
implementation("com.github.rajasharan:java8-easy-monads:-SNAPSHOT")
}
<dependency>
<groupId>com.github.rajasharan</groupId>
<artifactId>java8-easy-monads</artifactId>
<version>-SNAPSHOT</version>
</dependency>
libraryDependencies += "com.github.rajasharan" % "java8-easy-monads" % "-SNAPSHOT"
:dependencies [[com.github.rajasharan/java8-easy-monads "-SNAPSHOT"]]
The purpose of this project is to teach myself about Monads and Functors.
And the best way to teach myself was by implementing some of the commonly used monads and functors.
As a starting step my goal is to implement map
and flatMap
for each monad as well as show some good usage examples.
I'm still undecided on implementing ap
for Applicatives but if I find a very good example to showcase then I plan to do it.
The examples also try to show composing monads via chaining them as method calls.
The following monads are implemented so far:
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
dependencies {
compile 'com.github.rajasharan:java8-easy-monads:master-SNAPSHOT'
}
$ ./gradlew :examples:run
...
The MIT License (MIT)