Skip to content

Latest commit

 

History

History
264 lines (181 loc) · 9.16 KB

File metadata and controls

264 lines (181 loc) · 9.16 KB
layout title permalink
docs-core
Libraries
/quickstart/libraries/

Core Libraries

Arrow is a modular set of libraries that build on top of each other to provide increasingly higher level features.

One of our design principles is to keep each library as lean as possible to avoid pulling unnecessary dependencies, specifically to support Android development where app size affects performance. You're free to pick and choose only those libraries that your project needs! Thereby, one only needs to download the toplevel artifacts if it's desired to download the datatypes, typeclasses and their respective extensions.

In this doc, we'll describe all the modules that form the core, alongside a list of the most important constructs they include.

Table of Content

  • [arrow-core]({{ '/quickstart/libraries/#arrow-core' | relative_url }})
  • [arrow-core-data]({{ '/quickstart/libraries/#arrow-core-data' | relative_url }})
  • [arrow-optics]({{ '/quickstart/libraries/#arrow-optics' | relative_url }})
  • [arrow-fx-coroutines]({{ '/quickstart/libraries/#arrow-fx-coroutines' | relative_url }})
  • [arrow-fx-stm]({{ '/quickstart/libraries/#arrow-fx-stm' | relative_url }})
  • [arrow-syntax]({{ '/quickstart/libraries/#arrow-syntax' | relative_url }})
  • [arrow-fx-rx2 & arrow-fx-reactor]({{ '/quickstart/libraries/#arrow-fx-rx2&arrow-fx-reactor' | relative_url }})
  • [arrow-mtl]({{ '/quickstart/libraries/#arrow-mtl' | relative_url }})
  • [arrow-mtl-data]({{ '/quickstart/libraries/#arrow-mtl-data' | relative_url }})
  • [arrow-recursion]({{ '/quickstart/libraries/#arrow-recursion' | relative_url }})
  • [arrow-recursion-data]({{ '/quickstart/libraries/#arrow-recursion-data' | relative_url }})
  • [arrow-integrations-retrofit-adapter]({{ '/quickstart/libraries/#arrow-integrations-retrofit-adapter' | relative_url }})
  • [arrow-free]({{ '/quickstart/libraries/#arrow-free' | relative_url }})
  • [arrow-free-data]({{ '/quickstart/libraries/#arrow-free-data' | relative_url }})
  • [arrow-aql]({{ '/quickstart/libraries/#arrow-aql' | relative_url }})
  • [arrow-meta]({{ '/quickstart/libraries/#arrow-meta' | relative_url }})
  • [arrow-generic]({{ '/quickstart/libraries/#arrow-generic' | relative_url }})

arrow-core

dependencies {
    implementation "io.arrow-kt:arrow-core:$arrow_version"
}

This library include the possible [typeclass extensions]({{ '/patterns/glossary/#instances-and-extensions-interfaces' | relative_url }}) including datatypes and typeclasses from arrow-core-data that can be implemented for the datatypes in their respective libraries.

Dependency: arrow-core-data

arrow-core-data

dependencies {
    implementation "io.arrow-kt:arrow-core-data:$arrow_version"
}

The smallest set of datatypes and all basic [typeclasses]({{ '/typeclasses/intro' | relative_url }}) necessary to start in FP, and that other libraries can build upon. The focus here is on API design and abstracting small code patterns.

arrow-optics

dependencies {
    implementation "io.arrow-kt:arrow-optics:$arrow_version"
}

Optics is the functional way of handling immutable data and collections in a way that's boilerplate free and efficient.

Arrow Optics offers a way of declaring how to focus deeply into immutable structure without boilerplate. It also offers an [Optics DSL]({{ '/optics/dsl/' | relative_url }}) to elegantly describe complex use-cases in an elegant and simple manner without requiring to understand the underlying theory.

For all the new typeclasses, it also includes the extensions available for basic types and datatypes in both arrow-core and arrow-extras.

Dependency: arrow-core

arrow-fx-coroutines

dependencies {
    implementation "io.arrow-kt:arrow-fx-coroutines:$arrow_version"
}

The [fx library]({{ '/fx/' | relative_url }}) is a Kotlin idiomatic functional effects system that offers a powerful set concurrency combinators and primitives with an emphasis on easy concurrency and parallelism with guarantees about concurrent and parallel resource safety and composition. If offers a set of integrations for KotlinX Coroutines, RxJava, Reactor, etc. Check the [Arrow Fx documentation](({{ '/fx/' | relative_url }})) for more details.

Dependency: arrow-core

arrow-fx-stm

dependencies {
    implementation "io.arrow-kt:arrow-fx-stm:$arrow_version"
}

The STM module provides powerful combinators to build safe stateful transactions in a concurrent settings. Transactions are guaranteed to not cause deadlocks or race conditions. This guarantee also carries over on composition which enables users to build everything from single transactions to fully concurrent datastructures.

The module also provides several common datastructures such as Queues, Semaphores, Maps and more.

Dependency: arrow-fx-coroutines

Extension libraries

These libraries are hosted inside the Arrow repository building on the core, to provide higher level constructs to deal with concepts rather than code abstraction.

arrow-syntax

dependencies {
    implementation "io.arrow-kt:arrow-syntax:$arrow_version"
}

Multiple extensions functions to work better with function objects and collections.

For function objects, the library provides composition, currying, partial application, memoization, pipe operator, complement for predicates, and several more helpers.

For collections, arrow-syntax provides firstOption, tail, basic list traversal, and tuple addition.

Dependency: arrow-core

arrow-fx-rx2 & arrow-fx-reactor

dependencies {
    implementation "io.arrow-kt:arrow-fx-rx2:$arrow_version"
    implementation "io.arrow-kt:arrow-fx-reactor:$arrow_version"
}

Each of these modules provides wrappers over the datatypes in each of the libraries that implement all the typeclasses provided by arrow-fx

[Rx]({{ 'integrations/rx2/' | relative_url }})

[Reactor]({{ 'integrations/reactor/' | relative_url }})

Dependency: arrow-fx

arrow-mtl

dependencies {
    implementation "io.arrow-kt:arrow-mtl:$arrow_version"
}

Advanced [typeclasses]({{ '/typeclasses/intro' | relative_url }}) to be used in programs using the Tagless-final architecture.

It also includes the extensions available for datatypes in arrow-core

Dependency: arrow-mtl-data

arrow-mtl-data

dependencies {
    implementation "io.arrow-kt:arrow-mtl-data:$arrow_version"
}

Dependency: arrow-core

arrow-recursion

dependencies {
    implementation "io.arrow-kt:arrow-recursion:$arrow_version"
}

Recursion schemes is a construct to work with recursive data structures in a way that decouples structure and data, and allows for ergonomy and performance improvements.

Dependency: arrow-recursion-data

arrow-recursion-data

dependencies {
    implementation "io.arrow-kt:arrow-recursion-data:$arrow_version"
}

This library includes the datatypes and typeclasses in Recursion schemes.

Dependency: arrow-core

arrow-integrations-retrofit-adapter

dependencies {
    implementation "io.arrow-kt:arrow-integrations-retrofit-adapter:$arrow_version"
}

The [adapter]({{ 'integrations/retrofit/' | relative_url }}) is a library that adds integration with Retrofit, providing extensions functions and/or classes to work with Retrofit by encapsulating the responses in the chosen datatypes through the use of typeclasses.

Dependency: arrow-fx

arrow-free

dependencies {
    implementation "io.arrow-kt:arrow-free:$arrow_version"
}

The [Free datatype]({{ '/free/free/' | relative_url }}) is a way of interpreting domain-specific languages from inside your program, including a configurable runner and flexible algebras. This allows optimization of operations like operator fusion or parallelism, while remaining on your business domain.

Dependency: arrow-free-data

arrow-free-data

dependencies {
    implementation "io.arrow-kt:arrow-free-data:$arrow_version"
}

This library includes the datatypes in Free.

Dependency: arrow-core

arrow-aql

dependencies {
    implementation "io.arrow-kt:arrow-aql:$arrow_version"
}

This [Arrow Query Library]({{ '/aql/intro/' | relative_url }}) focuses on bringing SQL-like syntax to Arrow datatypes.

Dependency: arrow-core

Annotation processors

These libraries focus on meta-programming to generate code that enables other libraries and constructs.

arrow-meta

apply plugin: 'kotlin-kapt' //optional
apply from: rootProject.file('gradle/generated-kotlin-sources.gradle') //only for Android projects

dependencies {
    kapt "io.arrow-kt:arrow-meta:$arrow_version"
}

Allows boilerplate generation for [@extension]({{ '/patterns/glossary/#instances-and-extensions-interfaces/' | relative_url }}) instances and [@higherkind]({{ '/patterns/glossary/#higher-kinds' | relative_url }}) datatypes.

arrow-generic

apply plugin: 'kotlin-kapt' //optional
apply from: rootProject.file('gradle/generated-kotlin-sources.gradle') //only for Android projects

dependencies {
    kapt "io.arrow-kt:arrow-generic:$arrow_version"
}

It allows annotating data classes with [@product]({{ '/generic/product/' | relative_url }}) to enable them to be structurally deconstructed in tuples and heterogeneous lists.