Functional Programming with Scala Cats

所在平台: Udemy

课程主页: https://www.udemy.com/course/functional-programming-with-scala-cats/

课程评论:没有评论

第一个写评论        关注课程

课程简介

课程名称:使用Scala Cats进行函数式编程 概述:当我们开始学习Scala时,最初的印象往往是“一个更好的Java”。我们学习类、特质、模式匹配及其他便于开发的结构。在某个时刻,我们接触到更高阶的方法,如map、filter和fold,这为我们打开了函数式编程的大门。但实际上,函数式编程的内容远不止如此。本课程将展示标准的函数式编程实践如何帮助我们编写更通用、更可靠和可测试的代码。 本课程分为三个主要部分: 第一部分:我们将学习类型类(typeclasses)。以对象的编码和解码为例,我们将掌握如何创建自身的类型类,并使用类型类模式编写多态代码。 第二部分:我们将深入探讨函数式编程中常见的类型类,包括Monad(单子)、Applicative(应用类)、Functor(函子)等。我们会利用著名的Cats库来实现它们,并结合Discipline、ScalaCheck和ScalaTest测试其法律性。完成这一部分后,您将能够为任意类型编写合法的类型类实例,并以自动化方式测试它们的有效性。 第三部分:我们将学习如何使用函数式结构执行许多常见编程任务,包括通过Validated数据类型进行验证、使用Reader单子进行依赖注入、通过Writer单子跟踪计算中的数据、使用State单子管理状态、使用Trampolines编写栈安全的计算、使用Eval单子实现延迟计算、通过ReaderT和OptionT等单子变换器组合单子栈,以及用简单但实用的IO单子来挂起效果。 我坚信实践是学习的最佳方式,因此在每个部分中我都添加了大量视频内练习,以及测试和作业。希望您能和我一样,享受这些练习的乐趣!欢迎来到课程,探索激动人心的函数式编程世界!

课程评论(0条)

课程详情

When we start our journey as a Scala developer, our first impression of the language may be that of 'a better Java'. We learn about classes, traits, pattern matching and some other constructs that make our life easier. At some point we come across the amazing higher-order methods such as map, filter and fold. These serve as a great first taste of functional programming.But what if I told you that there is much more than that? In this course I will show you how standard functional programming practices can help you write code that is more generic, robust and testable.This course is divided into 3 main sections.In the first section, we will learn about typeclasses. We will use as a driving example the problem of encoding and decoding objects into and from bytes. By the end of this section you will be able to create your own typeclasses and use the typeclass pattern to write polymorphic code.In the second section, we will take a look at some of the most common typeclasses in functional programming, including Monads, Applicatives, Functors and many more. We will use the famous Cats library to provide us with their implementations, and we will use Discipline along with ScalaCheck and ScalaTest to test their laws. By the end of this section, you will be able to write lawful instances of these typeclasses for any of your types, and test their validity in an automated manner.In the third and final section, we will learn to perform many common programming tasks with functional structures. These tasks include:- Validations via the Validated datatype- Dependency injection with the Reader monad- Tracking data in our computations with the Writer monad- Managing state with the State monad- Writing stack safe computations with Trampolines- Making computations lazy with the Eval monad- Composing monad stacks via monad transformers such as ReaderT and OptionT- Suspending effects with a simple but useful implementation of the IO monadI'm a big believer of learning by doing so I've included a lot of in-video exercises, along with quizzes and assignments at the end of each section. I hope you enjoy doing them as much as I enjoyed putting them together!Without further ado, I want to give you a big welcome to the course and the thrilling world of functional programming!

课程标签

0人关注该课程

主题相关的课程