Skip to content
0:00 / 0:00

#lenses#optics#haskelllens

John Wiegley: Putting Lenses to Work

Bay Area Haskell

681 subscribers • 4 videos on Hallway

YouTube
  • Recommended by 6 people: 4 on Hacker News, 1 on Lobsters and 1 in engineering communities.
  • A classic. People kept recommending it from 2017 to 2024.
  • Presented by John Wiegley
  • Linked in the descriptionjwiegley/putting-lenses-to-work

Intermediate. Assumes working knowledge.

12K views9 years ago6 recommendations

Programming languagesSoftware designHaskellFunctional programmingDesign patterns

John Wiegley explains Haskell lenses through practical examples, demonstrating how to use them for complex data manipulation beyond simple record access.

Presented at BayHac 2017 wiki.haskell.org/BayHac2017 Slides: github.com/jwiegley/putting-lenses-to-work/blob/master/putti…

Why it's here

6 people recommend this

What people say. Highly recommended as a practical, digestible introduction to Haskell lenses that helps developers become productive quickly without getting bogged down in theory.

u/ysangkokin r/haskell • Recommends

John Wiegley: Putting Lenses to Work

julienxxon Lobsters • Recommends

Putting Lenses to Work

platzon Hacker News • Recommends

On “Haskell for a New Decade [pdf]”

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: link to this video

turboponyyon Hacker News • Recommends

On “Ask HN: What resources do you recommend for learning Haskell?”

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: link to this video

ParetoOptimalon Hacker News • Recommends

On “Dhall: A Gateway Drug to Haskell”

Good examples in "Putting lenses to work" by John Weigley: link to this video Then for a great book that gives a great understanding see Chris Penner's amazing and fun "Optics by example: link

ParetoOptimalon Hacker News • Recommends

On “Lenses”

> 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: link to this video

lgason Hacker News • Recommends

On “Ask HN: What piece of code/codebase blew your mind when you saw it?”

Definitely agree on lenses being one of the more mind blowing things I've encountered and eventually grokked in programming. I would also recommend link to this 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.

u/lgastakoin r/functionalprogramming • Mentions

On “Best FP language for data science?”

I probably should've mentioned that most of the work we've been doing so far is definitely not "big data" and mostly involves running NLP processes over streams of data. We've found for our work, for example, chatter fairly useful, but mostly we've been working on our own approaches and found the library ecosystem very helpful in building the pipeline and infrastructure that powers our applications and the language itself helpful for implementing our own algorithms. For example we've found streaming in combination with foldl to be amazing for implementing pretty much any streaming algorithm you want in such a manner that the code is simultaneously straightforward and easy to understand whi…