John Wiegley: Putting Lenses to Work
Bay Area Haskell4 HN recommenders · 2020–2024
13K views · talk · evergreen · Uploaded 2017-04-22
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.
HN recommends it as the fastest way to learn lenses by example, with far-out examples later on.
53:22Ruby Conf 12 - Y Not- Adventures in Functional Programming by Jim Weirich
Confreaks
42:03The Soul of Erlang and Elixir • Sasa Juric • GOTO 2019
GOTO Conferences
1:01:39"Simple Made Easy" - Rich Hickey (2011)
Strange Loop Conference
25:06"Making Impossible States Impossible" by Richard Feldman
elm-conf
1:31:06William Byrd on "The Most Beautiful Program Ever Written" [PWL NYC]
PapersWeLove
31:44The Value of Values with Rich Hickey
InfoQ
46:09Why Isn't Functional Programming the Norm? – Richard Feldman
Metosin
1:03:29Maybe Not - Rich Hickey
ClojureTV
5 comments from Hacker News
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]
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]
> 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 this presentation: [VIDEO]
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.
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]