Everyday Optics 2025

Posted By: ELK1nG

Everyday Optics
Last updated 2/2025
MP4 | Video: h264, 1920x1080 | Audio: AAC, 44.1 KHz
Language: English | Size: 2.39 GB | Duration: 1h 42m

Navigate optics with awareness and skill

What you'll learn

When and when not to use optics

How to effectively implement optics in your production code

Common ways of using optics, from simple records to deeply nested data structures

Various naming conventions and primary libraries

Ability to select the most suitable optic library for your projects

Requirements

Experience with Haskell is needed.

Description

Optics should be used, but they should be used with awareness.Optics allow us to read and modify parts of different data structures, such as fields of records, variants of unions, or elements of containers.This course is not a generic overview of optics — instead, we’ll focus on why optics are fantastic, when to use them, when not to use them, and how to use them in the production code.Most people either fear and avoid them or love them so much that they use them for everything. We’re going to cover the most common ways of using optics:Use optics to work with simple records (bad idea).Use (generic) lenses to work with simple and nested records.Use optics with specific data and libraries (e.g. lens-aeson, amazonka).Use optics here and there for complex data and deeply nested records.This course will review optics, cover the most popular encodings, the problems optics solve, naming conventions, concrete libraries, and techniques. We’ll also learn how to use optics to work with JSON. But we'll not discuss who will win in a fight: Joker from profunctors or Twan van Laarhoven.This course is for people who:want to actually start using optics;want to introduce optics to their production code;want to understand how to choose an optic library;want to find an ergonomic way to deal with Haskell records;or want to find their comfort zone of using optics.This course is not for people who:want another optics overview;want another theoretical explanation on how to build an optic library;want to use and understand fancy operators;or want to use optics for everything.Throughout the course, we’re going to cover a few libraries:lensgeneric-lensopticslens-aesonWe expect that you are familiar with Haskell and a few extensions, such as OverloadedStrings. We’ll use DataKinds, DeriveGeneric, DuplicateRecordFields, FlexibleContexts, FunctionalDependencies, NamedFieldPuns, OverloadedLabels, RecordWildCards, TemplateHaskell, TypeApplications, and a few others. We’ll give a one-two sentence explanation when we enable each extension or dive deeper when it’s crucial. So you don’t have to know them in advance for this course. But if you want to — see our course on extensions.

Overview

Section 1: Введение

Lecture 1 Optics overview

Lecture 2 When to use optics

Lecture 3 When not to use optics

Lecture 4 How to choose your optics style

Lecture 5 Generic lens

Lecture 6 Libraries lens

Lecture 7 Libraries microlens

Lecture 8 Libraries optics

Lecture 9 Using optics with JSON

Lecture 10 Bonus section

Middle and Senior Haskell developers who want to know more about optics.