This course provides an introduction to Functional Programming concepts in Kotlin using the Arrow library.
One year of experience using Kotlin or similar Functional Programming-oriented languages
What you'll learn
In this intensive two-day course, we'll cover Functional Programming essentials in Kotlin. By the end of this course, you will have a solid grasp on the Fundamentals of the language.
Lesson 1 - Functional Programming
- Fundamentals of FP. What is it, what is it good for.
- Purity, referential transparency, substitution model.
- Side effects.
- Higher order functions.
Lesson 2 - Domain Modeling and ADTs
- Kotlin type system and its impact on how compiler understands code.
- Algebraic Data Types.
- Modeling program choices by ADTs.
- The Nothing bottom type and inference.
- Kotlin standard library product types.
- Arrow product and sum types.
- Arrow Coproducts.
- Arrow Union types (powered by Arrow Meta).
- Refined types (powered by Arrow Meta).
Lesson 3 - Immutable Data and Optics
- Understanding optics as a path for reading / modification.
- How optics improve Kotlin standard library copy syntax.
- Going over all the available types of optics.
- Optics composition and reusability.
Lesson 4 - Error-Handling and Data Validation
- Option datatype.
- Either datatype.
- Computational bias: Having a happy path in our types.
- Fail fast vs error accumulation strategies.
- ValidatedNel as a mean to accumulate errors.
- How to handle errors on concurrent contexts? 👇
Lesson 5 - Diving into Suspend
- `suspend` from Kotlin stdlib, what it represents, how it works.
- What does `suspend` translate to at compile time (CPS).
- How we leverage that with Arrow Fx Coroutines.
- The power of delimited continuations, the mother of all monads.
- Equivalence between wrapped approaches and Kotlin suspend.
- Removing the need for IO wrappers.
- `suspend` as a mean to track side effects at compile time.
Lesson 6 - Arrow Fx Coroutines
- A pure functional implementation of Kotlin `suspend` system.
- Handling errors in concurrent contexts by leveraging `suspend` + `Either`.
- Concurrency solved by Arrow Fx Coroutines operators.
- Collaborative cancellation checked by all operators.
- Cancellable effects.
- Evaluating effects on arbitrary contexts.
- Fibers as lightweight threads: ForkAndForget / ForkConnected / ForkScoped.
- Concurrent resource safety.
- Handling concurrent mutable state.
- Parallelization operators.
- Traversing effects.
- Racing effects.
- Reusable and highly composable retry & repeat strategies.
Lesson 7 - Resource Safety
Lesson 8 - Functional Streams
- Lightweight streams.
- Pull based - key differences vs other known streaming libraries.
- Built-in backpressure.
- Chunk based streams.
- Embedded effects.
- Stream interruption.
- Lightweight stream apis.
- Safely streaming resources with automatic scoping.