Functional effect handling in Scala with Cats Effect
What you’ll learn
Model and compose effectful computations in a pure manner.
Design an error handling strategy taking side-effects into consideration.
Increase concurrency and parallelism of an application with high-level methods.
Safely use and release resources such as connections, io streams, etc.
Handle complex concurrent scenarios involving shared state and thread communication with purely functional primitives.
Requirements
Working knowledge of the Scala language (case classes, pattern matching, traits, implicits, etc.)
(Helpful) Knowledge of functional typeclasses such as Monads, Applicatives and Functors
(Helpful) Some experience with the Cats library
Description
When you first hear about functional programming you might get the impression that it can only be used in toy examples or for very academic purposes. After all, FP is all about purity and almost every useful thing you can do in a program is impure: http calls, file IO, and so on.In this course I’m going to show you that FP is actually amazing for dealing with effects. By separating program description from execution you will be able to build computations that are easy to compose and reason about, while at the same time keeping all the usefulness of side-effects.In order to do so, we are going to use the amazing Cats Effect library, which provides an IO monad to model our effects, a very rich API to compose them, and a highly-performant runtime to execute them.The course is structured in many small/medium sized sections that focus on one specific topic. At the end of each section there is a final exercise to practice what you learned, and a quiz to help check your recall and understanding of the section.By the end of the course, you will be able to:Write and compose computations you want to run, before actually running them.Design an error handling strategy for your application, taking side-effects into consideration.Increase the parallelism and concurrency of your programs without the need to handle low-level details.Use and compose resources that need to be released (connections, io streams, etc.) in an elegant manner.Handle complex scenarios involving concurent shared state and thread communication by using purely functional primitives.Hopefully, you will also have some fun along way!
Overview
Section 1: Introduction
Lecture 1 Introduction
Lecture 2 Setting up environment
Lecture 3 How to take this course
Lecture 4 Course files
Section 2: Effects in Programming
Lecture 5 Introduction
Lecture 6 Referential transparency
Lecture 7 Id generator
Lecture 8 Optionality
Lecture 9 State
Lecture 10 Error handling
Lecture 11 Printing to console
Lecture 12 Writing to disk
Lecture 13 Referentially transparent IO
Lecture 14 Definitions and clarifications
Section 3: The IO Monad
Lecture 15 Intro
Lecture 16 Basic usage
Lecture 17 IOApp
Lecture 18 Exercise
Section 4: Error Handling
Lecture 19 Intro
Lecture 20 Setting up API example
Lecture 21 Validating inputs with Validated
Lecture 22 Modeling domain errors with Either
Lecture 23 Loading accounts with a Repository
Lecture 24 Adding business logic with a Service
Lecture 25 Combining logic into the final Controller
Lecture 26 Testing
Lecture 27 Ignoring Fatal Errors
Lecture 28 Exercise
Section 5: Concurrency and Parallelism
Lecture 29 Intro
Lecture 30 ParMapN
Lecture 31 ParTraverse
Lecture 32 Race
Lecture 33 Exercise
Section 6: Resource Safety
Lecture 34 Intro – Bracket
Lecture 35 Writing to files with bracket
Lecture 36 Intro – Resource
Lecture 37 Copying and encrypting files with Resource
Lecture 38 Exercise
Section 7: Asynchronous Computations
Lecture 39 Intro
Lecture 40 Transforming a Future by blocking
Lecture 41 Avoiding blocking with async_
Lecture 42 Using fromFuture for conciseness
Lecture 43 Running on different thread pools with evalOn
Lecture 44 Exercise
Section 8: Memoization
Lecture 45 Intro
Lecture 46 Setting up templates example
Lecture 47 Loading templates eagerly
Lecture 48 Loading templates on error only
Lecture 49 Memoizing templates
Lecture 50 Exercise
Section 9: Time
Lecture 51 Intro
Lecture 52 Handling token expirations with realTime
Lecture 53 Measuring how long computations run with monotonic
Lecture 54 Exercise
Section 10: Concurrent Shared State Part I – Refs
Lecture 55 Intro
Lecture 56 Loading customers
Lecture 57 Storing the logs in a Ref
Lecture 58 Using one Ref per customer
Lecture 59 Exercise
Section 11: Concurrent Shared State Part II – Deferred
Lecture 60 Intro
Lecture 61 Showing items in a GUI
Lecture 62 Adding parallelism with parMapN
Lecture 63 Communicating processes with Deferred
Lecture 64 Adding error handling
Lecture 65 Exercise
Section 12: Queue
Lecture 66 Intro
Lecture 67 Processing events with queues
Lecture 68 Exercise
Section 13: Thread Pools
Lecture 69 Types of Thread Pools
Lecture 70 Work stealing pools
Lecture 71 Cached Unbounded Pools
Lecture 72 Execution contexts
Lecture 73 Choosing the correct thread pool
Lecture 74 Using compute and blocking pools
Lecture 75 Exercise
Section 14: Tagless final
Lecture 76 Intro – Typeclasses in cats effect
Lecture 77 Intro – Parallel
Lecture 78 Intro – Tagless final
Lecture 79 Setting up example
Lecture 80 Convert an IO application into a Tagless Final application
Lecture 81 Exercise
Scala developers with some experience in functional programming
Course Information:
Udemy | English | 7h 11m | 2.08 GB
Created by: Leandro Galvan
You Can See More Courses in the Developer >> Greetings from CourseDown.com