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

Documentation: fix broken links and remove old content #2345

Merged
merged 2 commits into from
Mar 30, 2021
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
31 changes: 17 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ Use the list below to learn more about Λrrow's main features.

#### Curated external links

- [Projects and Examples](http://arrow-kt.io/docs/quickstart/projects/)
- [Media: blogs, presentations, etc.](https://media.arrow-kt.io)

If you have a blog post, talk, or upcoming event on Arrow, please considering opening an issue or PR to add to the collection over at the [Arrow Media](https://github.com/arrow-kt/arrow-media) repo.
Expand All @@ -42,33 +41,24 @@ Find more details in [CONTRIBUTING](CONTRIBUTING.md).

## Setup

### Next development version

If you want to try the last features, replace `0.11.0` by `0.12.0-SNAPSHOT` in the following guideline.

### JDK

Make sure to have the latest version of JDK 1.8 installed.

### Android

Arrow supports Android out of the box starting on API 21 and up.

We'll be working on a Arrow-Android integration module that adds some helpers and integrations.
Arrow supports Android starting on API 21 and up.

### Gradle

#### Basic Setup

In your project's root `build.gradle`, append these repositories to your list:
In your project's root `build.gradle`, append this repository to your list:

```groovy
allprojects {
repositories {
mavenCentral()
jcenter()
maven { url "https://dl.bintray.com/arrow-kt/arrow-kt/" }
maven { url "https://oss.jfrog.org/artifactory/oss-snapshot-local/" } // for SNAPSHOT builds
}
}
```
Expand Down Expand Up @@ -212,9 +202,9 @@ Add the dependencies that you want to use:
</dependency>
```

#### Enabling kapt
#### Enabling kapt for the Optics DSL

Enable annotation processing using Kotlin plugin:
For the Optics DSL, enable annotation processing using Kotlin plugin:
```xml
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
Expand Down Expand Up @@ -283,6 +273,19 @@ To avoid specifying the Arrow version for every dependency, a BOM file is availa
</dependencies>
```

## Next development version

If you want to try the latest features, replace `0.11.0` with `0.12.0-SNAPSHOT` and add this repository:

```groovy
allprojects {
repositories {
...
maven { url "https://oss.jfrog.org/artifactory/oss-snapshot-local/" }
}
}
```

## License

Copyright (C) 2017 The Λrrow Authors
Expand Down
2 changes: 1 addition & 1 deletion arrow-site/docs/_data/sidebar-core.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
options:
- title: Quick Start
url: /quickstart/
url: /core/

- title: Tutorials

Expand Down
24 changes: 0 additions & 24 deletions arrow-site/docs/docs/arrow/typeclasses/intro/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,16 +174,6 @@ We will list them by their hierarchy.

- [`Traverse`]({{ '/apidocs/arrow-core-data/arrow.typeclasses/-traverse/' | relative_url }}) - has a structure for which each element can be visited and get applied an effect

#### Effects

Effects provides a hierarchy of typeclasses for lazy and asynchronous execution.

- [`MonadDefer`]({{ '/effects/monaddefer/' | relative_url }}) - can evaluate functions lazily

- [`Async`]({{ '/effects/async/' | relative_url }}) - can be created using an asynchronous callback function

- [`Effect`]({{ '/effects/effect/' | relative_url }}) - can extract a value from an asynchronous function

#### MTL

The Monad Template Library module gives more specialized version of existing typeclasses
Expand All @@ -196,12 +186,6 @@ The Monad Template Library module gives more specialized version of existing typ

- [`MonadCombine`]({{ '/arrow/typeclasses/monadcombine/' | relative_url }}) - has a structure that can be combined and split for several datatypes

- [`MonadReader`]({{ '/arrow/mtl/typeclasses/monadwriter/' | relative_url }}) - can implement the capabilities of the datatype [`Reader`]({{ '/arrow/mtl/reader/' | relative_url }})

- [`MonadWriter`]({{ '/arrow/mtl/typeclasses/monadwriter/' | relative_url }}) - can implement the capabilities of the datatype [`Writer`]({{ '/arrow/mtl/writert/' | relative_url }})

- [`MonadState`]({{ '/arrow/mtl/typeclasses/monadstate' | relative_url }}) - can implement the capabilities of the datatype [`State`]({{ '/arrow/mtl/state/' | relative_url }})

#### Optics

- [`At`]({{ '/optics/at/' | relative_url }}) - provides a [`Lens`]({{ '/optics/lens/' | relative_url }}) for a structure with an indexable focus
Expand All @@ -211,11 +195,3 @@ The Monad Template Library module gives more specialized version of existing typ
- [`Index`]({{ '/optics/index/' | relative_url }}) - provides an [`Optional`]({{ '/optics/optional/' | relative_url }}) for a structure with an indexable optional focus

- [`Each`]({{ '/optics/each/' | relative_url }}) - provides a [`Traversal`]({{ '/optics/traversal/' | relative_url }})

#### Recursion

- [`Corecursive`]({{ '/recursion/corecursive/' | relative_url }}) - traverses a structure forwards from the starting case

- [`Recursive`]({{ '/recursion/recursive/' | relative_url }}) - traverses a structure backwards from the base case

- [`Birecursive`]({{ '/recursion/birecursive/' | relative_url }}) - it is both recursive and corecursive
5 changes: 0 additions & 5 deletions arrow-site/docs/docs/patterns/dependencyinjection/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,8 @@ permalink: /patterns/dependency_injection/
video: CR5h2Wq1yPE
---

If you would like to know about using the [`Reader`]({{ '/arrow/mtl/reader/' | relative_url }}) datatype instead, visit [this article](https://jorgecastillo.dev/kotlin-dependency-injection-with-the-reader-monad) by [Jorge Castillo](https://github.com/JorgeCastilloPrz).

## Dependency Injection using the `Typeclassless` technique




Arrow allows abstracting polymorphic code that operates over the evidence of having an instance of a [typeclass]({{ '/typeclasses/intro' | relative_url }}) available.
This enables programs that are not coupled to specific datatype implementations.
The technique for writing polymorphic code demonstrated below is available for all other typeclasses besides [`Functor`]({{ '/arrow/typeclasses/functor' | relative_url }}).
Expand Down
2 changes: 1 addition & 1 deletion arrow-site/docs/docs/patterns/glossary/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ These solutions have a canonical implementation that is generalized for all poss

Some common patterns expressed as datatypes are absence handling with [`Option`]({{ '/apidocs/arrow-core-data/arrow.core/-option/' | relative_url }}),
branching in code with [`Either`]({{ '/apidocs/arrow-core-data/arrow.core/-either/' | relative_url }}),
or interacting with the platform the program runs in using [`suspend`]({{ '/effects/async' | relative_url }}).
or interacting with the platform the program runs in using `suspend`.

Some of these patterns are implemented using a mix of `sealed` classes, where each inheritor is a `data` class.
For example, the internal representation of an `Option` is a `sealed` class with two `data` classes: `Some<A>(val a: A)`, and `None`.
Expand Down
16 changes: 8 additions & 8 deletions arrow-site/docs/docs/patterns/monadcomprehensions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ They allow us to write sequenced code that can be run asynchronously over multip
The abstraction of sequencing execution of code is summarized in a single function that, in Arrow, is called `invoke`,
although you may find it referred to in other languages as `andThen`, `then`, `bind`, `flatMap` or `SelectMany`. Arrow chooses `invoke` over functions like flatMap because Kotlin is able to perform monad bind in place thanks to its continuation system.

Arrow provides concrete Monad impls for all data types that can support `F<A> -> A` The [typeclass]({{ '/typeclasses/intro' | relative_url }}) interface that abstracts Delimited Scopes and allows us to implement the `suspend operator fun <A> F<A>.invoke(): A` sequenced execution of code via `fold`, `flatMap` and others is called a [`Effect`]({{ '/arrow/continuations/effect' | relative_url }}),
Arrow provides concrete Monad impls for all data types that can support `F<A> -> A` The [typeclass]({{ '/typeclasses/intro' | relative_url }}) interface that abstracts Delimited Scopes and allows us to implement the `suspend operator fun <A> F<A>.invoke(): A` sequenced execution of code via `fold`, `flatMap` and others is called a `Effect`,
for which we also have a [tutorial]({{ '/patterns/monads' | relative_url }}).

Implementations of [`Effect`]({{ '/arrow/continuations/effect' | relative_url }}) are available for internal types like `Either`, `Option` and others.
Let's see one example of the block `either` that uses [`Effect`]({{ '/arrow/continuations/effect' | relative_url }}) to implement monad `invoke` over `Either`. Here we fetch from a database the information about the dean of a university some student attend:
Implementations of `Effect` are available for internal types like `Either`, `Option` and others.
Let's see one example of the block `either` that uses Effect to implement monad `invoke` over `Either`. Here we fetch from a database the information about the dean of a university some student attend:

```kotlin:ank:playground
import arrow.core.computations.either
Expand Down Expand Up @@ -111,14 +111,14 @@ While this coding style based on flatMap is an improvement for domains like asyn

This feature is known with multiple names: async/await, coroutines, do notation, for comprehensions, etc. Each version contains certain unique points, but all derive from the same principles.
In Kotlin, coroutines (introduced in version 1.1 of the language) make the compiler capable of rewriting seemingly synchronous code into asynchronous sequences.
Arrow uses this capability of the compiler to bring you coroutines-like notation to all instances of the [`Effect`]({{ '/arrow/continuations/Effect' | relative_url }}) interface.
Arrow uses this capability of the compiler to bring you coroutines-like notation to all instances of the `Effect` interface.

This means that comprehensions are available for `Option`, `Either`, `Eval`, and other datatypes.
In the following examples, we'll use `Either`, as it's a simple datatype that thanks to its inlined api and suspended comprehensions can be inter mixed with concurrency and async behaviors in the same scope.

Most instances of [`Effect`]({{ '/arrow/continuations/effect' | relative_url }}) contain a method `invoke` brings the ability to extract in place a type `<A>` from a `F<A>` where F is the implementing data-type of the Effect interface.
Most instances of `Effect` contain a method `invoke` brings the ability to extract in place a type `<A>` from a `F<A>` where F is the implementing data-type of the Effect interface.

The [`Effect`]({{ '/arrow/continuations/effect' | relative_url }}) interface is itself exposed as receiver functions which projects its scope including the ability to perform monad bind via the `invoke` operator.
The `Effect` interface is itself exposed as receiver functions which projects its scope including the ability to perform monad bind via the `invoke` operator.

Let's see a minimal example.

Expand All @@ -137,7 +137,7 @@ suspend fun main() {

Anything in the function inside `either` can be imperative and sequential code that'll be executed when the data type decides.

In the case of [`Either`]({{ '/arrow-core-data/arrow.core/-either/' | relative_url }}), it is strictly running and implemented in terms of fold. Let's expand the example by adding a second operation:
In the case of [`Either`]({{ '/apidocs/arrow-core-data/arrow.core/-either/' | relative_url }}), it is strictly running and implemented in terms of fold. Let's expand the example by adding a second operation:

```kotlin
import arrow.core.computations.either
Expand All @@ -149,7 +149,7 @@ either {
// Compiler error: the type of one is Either<Nothing, Int>, cannot add 1 to it
```

This is our first challenge. We've created an instance of [`Right`]({{ '/arrow-core-data/arrow.core/-either/' | relative_url }}), and we cannot get the value from inside it.
This is our first challenge. We've created an instance of [`Right`]({{ '/apidocs/arrow-core-data/arrow.core/-either/' | relative_url }}), and we cannot get the value from inside it.
From the previous snippet, the first intuition would be to call `fold` on `one` to get the value and otherwise throw an exception if it was a `Left`.
This will blow up the stack and won't be obvious to users that our method can fail with an exceptions. What we want instead is to suspend and short-circuit on Left values and continue computing over Right values.

Expand Down