Skip to content

Commit

Permalink
fixes error accumulation both on Result and Validation Monads
Browse files Browse the repository at this point in the history
  • Loading branch information
lucapiccinelli committed Mar 1, 2021
1 parent b51af88 commit 73830a4
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ add in pom.xml
<dependency>
<groupId>io.github.lucapiccinelli</groupId>
<artifactId>konad</artifactId>
<version>1.0.10</version>
<version>1.0.11</version>
</dependency>
```

#### Gradle
add in build.gradle
```groovy
dependencies {
implementation "io.github.lucapiccinelli:konad:1.0.10"
implementation "io.github.lucapiccinelli:konad:1.0.11"
}
```

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>io.github.lucapiccinelli</groupId>
<artifactId>konad</artifactId>
<version>1.0.10</version>
<version>1.0.11</version>
<packaging>jar</packaging>

<name>io.github.lucapiccinelli konad</name>
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/io/konad/Result.kt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ sealed class Result<out T>: ApplicativeFunctorKind<ResultOf, T>, MonadKind<Resul
is Ok -> map(liftedFn.value)
is Errors -> when(this){
is Ok -> liftedFn
is Errors -> Errors(error, liftedFn)
is Errors -> Errors(error, prev?.let { Errors(it.error, liftedFn)} ?: liftedFn)
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/io/konad/Validation.kt
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ fun <A, B, C> Validation<A, B>.ap(liftedFn: Validation<A, (B) -> C>): Validation
is Validation.Success -> map(liftedFn.success)
is Validation.Fail -> when(this){
is Validation.Success -> liftedFn
is Validation.Fail -> Validation.Fail(fail, liftedFn)
is Validation.Fail -> Validation.Fail(fail, prev?.let { Validation.Fail(it.fail, liftedFn)} ?: liftedFn)
}
}

Expand Down

0 comments on commit 73830a4

Please sign in to comment.