Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.51"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.60"
}
}

Expand All @@ -15,7 +15,7 @@ repositories {
}

dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:1.1.51"
compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:1.1.60"
compile 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.17'
compile 'com.beust:klaxon:0.30'
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/Json.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ inline fun <reified A: Any> JsonObject
}

fun JsonObject.toUser(): Result<User, ParseError> =
::User.curried() map
pure(::User.curried()) ap
getValue("username") ap
getValue("password") ap
getValue("premium") ap
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/Result.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ fun <A, E> Result<A, E>.ifSuccess(execute: (A) -> Unit) {

fun <A> pure(a: A): Result<A, Nothing> = Success(a)

infix fun <A, B, E> ((A) -> B).map(
result: Result<A, E>): Result<B, E> = result.map(this)

infix fun <A, B, E> Result<(A) -> B, E>.ap(
result: Result<A, E>): Result<B, E> = result.apply(this)

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/User.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ enum class UserError {
fun createUser(
name: String, password: String, premium: Boolean,
newsletter: Boolean): Result<User, UserError> =
::User.curried() map
pure(::User.curried()) ap
Name(name) ap
Password(password) ap
pure(premium) ap
Expand Down