Название: Optics By Example: Functional lenses in Haskell Автор: Chris Penner Издательство: Leanpub Год: 2020-04-22 Страниц: 390 Язык: английский Формат: epub, mobi + pdf (true) Размер: 22.9 MB, 10.1 MB
A comprehensive example-driven guide to Optics. Examples in Haskell, but adaptable to other languages. Become a data-manipulation wizard using Optics to manipulate data!
Lenses, also known as functional references, are a powerful way of looking at, constructing, and using functions on complex data types. They're also, unfortunately, a very new and complex subject making them challenging to learn. This book takes you from beginner to advanced using Lenses, Traversals, Prisms, and more!
Optics By Example is a one-stop comprehensive guide to mastering Optics in functional programming languages. It covers everything you need to know to go from complete beginner to advanced. Each topic is accompanied by copious examples and exercises!
What are Optics? Optics in its most general sense is a full field of study! In a slightly more concrete sense, optics are a family of tools which are interoperable with one another. Lenses, Folds, Traversals, Prisms and Isos are all types of optics which we’ll explore throughout the book! This isn’t a comprehensive list of all optics, in fact new types are still being discovered all the time! You’ll gain an intuition for what the more general concept of an optic actually is as you learn about each concrete type and begin to understand what they have in common, but to put it in a nutshell: optics are a family of inter-composable combinators for building bidirectional data transformations.
See the Sample for a complete list of chapters, but here are some highlights:
Complete introductions to Lenses, Folds, Traversals, Prisms and Isos Learn the magic of Indexed optics Composing Optics Lenses & Records Fixing "The Record Problem" Application design techniques using Classy optics Breakdowns of laws and limitations for each optic type Virtual lenses Validation lenses A guide to fully polymorphic optics A guide to "operator-style" Learn to query, filter, and aggregate data with surgical precision Learn how to use higher-order optics effectively Learn to write custom versions of all optics types for your own applications Manipulate data types with a clean and consistent interface Learn the monadic DSLs for using lenses in real monad stacks
Why Optics?
Optics have become a wonderful and powerful new way of working with immutable data structures. They're almost a necessity at this point; and the benefits they bring in terms of re-usability, simplification of code maintenance & refactoring, and expressivity are immense! However, learning to use optics can be tricky or even intimidating at first, it's not always clear how to build up a large complicated mutation or query from the building blocks of optics. Optics by example is here to help!
There are many different optics libraries available in many different programming languages. Unfortunately I don’t have time to write a book for each of them, so I’ve picked a specific implementation for consistency (and sanity) sake. This book’s examples and types are written in Haskell using the lens library3. This is the de-facto choice for using optics in Haskell at the time of writing this book.
This book is great as a first guide to optics, as a reference guide for discovering and mastering the optics you need for day-to-day problems, and as a springboard into new ideas and tools which you may not have even heard of.
Скачать Optics By Example: Functional lenses in Haskell
Внимание
Уважаемый посетитель, Вы зашли на сайт как незарегистрированный пользователь.
Мы рекомендуем Вам зарегистрироваться либо войти на сайт под своим именем.
Информация
Посетители, находящиеся в группе Гости, не могут оставлять комментарии к данной публикации.