John Wiegley: Putting Lenses to Work
Channel:Bay Area Haskell · Length:47:18 · Published:2017-04-22 · Views:12612
Summary
John Wiegley's BayHac 2017 talk walks through Haskell lenses by example, showing many practical uses beyond simple record access. It is aimed at people who want to become productive with the lens library.
Why HN recommends it
HN recommends it as the fastest way to learn lenses by example, with far-out examples later on.
you can learn enough lens to be productive in 1 hours with this talk without reading docs at all — HN, 2020
Subtitles (excerpt)
responsible hello everybody come to hear about lenses um this talk will not assume any prior experience or understanding of lenses there will be no Theory today I will not delve into lens types and most of the operators I won't touch either I work at BAE Systems my name is John Wigley we do research there and we use Haskell for a lot of the projects we do and in every single Hospital project we have there we use lenses and not because there's that one guy who thinks every project needs to have lenses in it but because all of us on the team have found they're extremely useful um so I kind of want to show you how we use lenses that work not all the things that this can do you can learn a lot of that in from other blog posts but there's sort of a core set of killer apps for lens that it does better than almost any other approach I want you to see that part of life so this is what I'm going to cover if I have all the time so lenses and prisons just to get some Basics out of the way traversals when the power of lens starts really kicking in um and then map and state which those are the two killer ones those are the ones where once you combine lenses prisms maps and state you've already used
On Hacker News
As with anything Haskell, one could simply reply with "here's the formal definition." But in easily digestible terms, it's a way to narrow your view over a collection to a subset that satisfies some property, and perhaps perform some operations on that subset. This video presentation (with a very humorous audience dynamic, might I add) serves as a great introduction by example: [VIDEO] — turboponyy, 2024-07
and you can learn enough lens to be productive in 1 hours with this talk without reading docs at all. You can skip the theory and go straight to usage: [VIDEO] — platz, 2020-06
Definitely agree on lenses being one of the more mind blowing things I've encountered and eventually grokked in programming. I would also recommend [VIDEO] as a good video on lenses in part because the latter portion has some pretty far-out examples of that deep well you mentioned. — lgas, 2022-11
Good examples in "Putting lenses to work" by John Weigley: [VIDEO] Then for a great book that gives a great understanding see Chris Penner's amazing and fun "Optics by example: [LINK] — ParetoOptimal, 2022-06
> Lenses let you do some amazing things, but I think most of their existence is just thanks to how truly horrible (nested) record field access and updates were. Only for the most basic uses. Architecting programs as folds or traversals can be powerful. One simple example of lenses i can think of being useful for more than record access is: > sumOf (folded . folded) [Just 1, Just 2] 3 More are in … — ParetoOptimal, 2022-06
Related videos
- Gabriella Gonzalez – How to market Haskell to a mainstream programmer · Konfy · 41:52
- Black hole Firewalls - with Sean Carroll and Jennifer Ouellette · The Royal Institution · 1:27:43
- Four Solutions to a Trivial Problem - Guy Steele Jr. · Google TechTalks · 1:01:47
- "Controlling Time and Space: understanding the many formulations of FRP" by Evan Czaplicki · Strange Loop Conference · 40:54
- Yanis Varoufakis: The Global Minotaur: America, Europe and the Future of the Global Economy · SkriptaTV · 57:27
- "Finding bugs without running or even looking at code" by Jay Parlar · Strange Loop Conference · 40:27
- Emacs From Scratch #1 - Getting Started with a Basic Usable Configuration · System Crafters · 58:29
- Ruby Conf 12 - Y Not- Adventures in Functional Programming by Jim Weirich · Confreaks · 53:21
- The Soul of Erlang and Elixir • Sasa Juric • GOTO 2019 · GOTO Conferences · 42:02
- "Simple Made Easy" - Rich Hickey (2011) · Strange Loop Conference · 1:01:38
- "Making Impossible States Impossible" by Richard Feldman · elm-conf · 25:06
- William Byrd on "The Most Beautiful Program Ever Written" [PWL NYC] · PapersWeLove · 1:31:05
- The Value of Values with Rich Hickey · InfoQ · 31:43
- Why Isn't Functional Programming the Norm? – Richard Feldman · Metosin · 46:09
- Maybe Not - Rich Hickey · ClojureTV · 1:03:28
- Solving Problems the Clojure Way - Rafal Dittwald · Clojure/north · 1:02:26