Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove extra spaces #301

Merged
merged 1 commit into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions content/docs/learn/design/domain-modeling.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ data class Event(
)
```

If we go back to our previous example, the compiler now fails to compile since we pass `Organizer ` where `Title` is expected, `Description` where `Organizer` is expected, and so on.
If we go back to our previous example, the compiler now fails to compile since we pass `Organizer` where `Title` is expected, `Description` where `Organizer` is expected, and so on.

```kotlin
Event(
Expand Down Expand Up @@ -87,7 +87,7 @@ Using an `enum class` is much more powerful than `String` for reasons beyond the
So it's much easier to reason about `AgeRestriction` than to reason and work with `String`.

In functional programming, this type of data composition is also known as a **sum type**, which models an _or_ relationship.
So we can say that an `AgeRestriction `is either `General` _or_ `PG` _or_ `PG13` _or_ `Restricted` _or_ `NC17`.
So we can say that an `AgeRestriction` is either `General` _or_ `PG` _or_ `PG13` _or_ `Restricted` _or_ `NC17`.
This tells us much more than if it was just a `String`. A `String` would have infinite values, while `AgeRestriction` modeled as an `enum class` only has five different values.
So using sum types can drastically reduce the complexity of our types.

Expand Down
4 changes: 2 additions & 2 deletions content/docs/learn/typed-errors/working-with-typed-errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ fun example() {
<!--- KNIT example-typed-errors-12.kt -->
<!--- TEST assert -->

The type system now tracks that a new error of `OtherError` might have occurred, but we recovered from any possible errors of `UserNotFound `. This is useful across application layers or in the service layer, where we might want to `recover` from a `DatabaseError` with a `NetworkError` when we want to load data from the network when a database operation failed.
The type system now tracks that a new error of `OtherError` might have occurred, but we recovered from any possible errors of `UserNotFound`. This is useful across application layers or in the service layer, where we might want to `recover` from a `DatabaseError` with a `NetworkError` when we want to load data from the network when a database operation failed.
To achieve the same with the `Raise` DSL, we need to be inside the context of `Raise<OtherError>` to `raise` it.

<!--- INCLUDE
Expand Down Expand Up @@ -653,7 +653,7 @@ If we want to accumulate all the errors, we can use `mapOrAccumulate` on `Iterab

Since you have potentially more than one failure, the error type in `Either` must be some sort of list.
However, we know that if we are not in the happy path, then _at least one_ error must have occurred.
Arrow makes this fact explicit by making the return type of `mapOrAccumulate ` a `NonEmptyList`, or `Nel` for short.
Arrow makes this fact explicit by making the return type of `mapOrAccumulate` a `NonEmptyList`, or `Nel` for short.

:::

Expand Down