Skip to content
0:00 / 0:00

#lenses#lenslibrary#traversals

Lenses, Folds, and Traversals

Edward Kmett

2.7K subscribers • 3 videos on Hallway

YouTube
  • Recommended by 5 people: 3 on Hacker News, 1 on Lobsters and 1 curated list.
  • A classic. People kept recommending it from 2013 to 2016.
  • Presented by Edward Kmett, creator of the Haskell lens library

Advanced. Deep dive for people who know the field.

54K views13 years ago5 recommendations

Programming languagesSoftware designFunctional programmingHaskellDesign patterns

Edward Kmett explains how to build highly composable combinators for accessing and modifying complex data structures using the lens library.

Slides: comonad.com/haskell/Lenses-Folds-and-Traversals-NYC.pdf This was a talk I gave at the second New York Haskell User Group Meeting (meetup.com/NY-Haskell/) on the new lens library, which provides a highly composable toolbox for accessing and modifying multiple parts of data structures. Starting with building blocks such as fmap and (.), we build up combinators suitable for working with a wide array of data structures. These generalize the notions you already know how to use into a form that is easier to compose and simultaneously allow them to be used for monomorphic containers such as Data.Text. All without compromising on your ability to reason about them using laws! Finally, once I've built up some foundations, I do a bit of a deep dive, exploring consequences of this design. In particular we discuss the efficient generic programming programming framework exported by lens, and type-safe Traversal-based zippers. Familiarity with the Applicative and Traversable classes from the Haskell base libraries will be helpful (links provided below), but a basic understanding of the concepts get introduced as I go along. Useful (but not mandatory) references: The lens library and documentation: hackage.haskell.org/package/lens A previous, more introductory talk on how to use the lenses Edward Kmett wrote for the scalaz in the Scala programming language: youtube.com/watch?v=efv0SQNde5Q The original Applicative paper: soi.city.ac.uk/~ross/papers/Applicative.pdf Lots of information on Traversable: cs.ox.ac.uk/jeremy.gibbons/publications/iterator.pdf A write-up of this talk, as presented at the Bay Area Haskell Users Group: google-opensource.blogspot.com/2012/10/lenses-folds-and-trav… The original Keynote version of the slides are available from comonad.com/haskell/Lenses-Folds-and-Traversals-NYC.key Thanks go to Johan Kiviniemi, who worked magic when it came to cleaning up the audio for this recording!

Why it's here

5 people recommend this

What people say. Recommended as a mind-blowing and comprehensive guide to understanding lenses and functional references in Haskell.

mijoharason Hacker News • Recommends

On “How I Start: Haskell”

I found this talk by edward kmett incredibly helpful0. I kept rewatching parts of it bit by bit until I managed to absorb it all (there is a lot of information for a beginner) but I found it hugely helpful and mind-blowingly powerful. 0 link to this video

apyon Lobsters • Recommends

Lenses, Folds, and Traversals

programming-talkscurated list on GitHubRecommends

Under “Haskell”

Lenses, Folds, and Traversals 01:54:46 by **Edward Kmett** (2012)

jerfon Hacker News • Recommends

On “Why is the C++ STL so heavily based on templates?”

…ress language is also doing some work here. A sample of the interesting sort of algorithm work that you can do when you think this way: link Edit: See also the Typeclassopedia: link And if you're really interested and want to take it hardcore, Edward Kmett's video on his lens library walks through how you can derive it with this sort of logic: link to this video…

dllthomason Hacker News • Recommends

On “Letter to a Young Haskell Enthusiast”

"The best forms of language advocacy probably involve showing the great things you've done with a language and forgetting about comparisons to the competition." Great things the parent has done with the language: link to this video

u/haskellgr8in r/haskell • Mentions

Explaining abstract Haskell stuff to mere mortals - and can mere mortals be professional Haskell devs? For example, only after watching this talk by S. P. Jones could I understand (a part of) E. Kmett's lens library. Contrast Jones's talk with this totally incomprehensible talk by E. Kmett :) Kmett and others like him will continue developing their great stuff and explaining it to other geniuses. That's fine. All I'm saying is it would be nice if more people made all this knowledge accessible to mere mortals. I have a question to you full-time professional Haskell devs: Do you think such "mere mortals" can be professional Haskell devs or should all professional Haskell devs be able to,…

u/Competitive_Ad2539in r/haskell • Mentions

Any good material about how to think about and use profunctors? I've met them in profunctor optics tutorials, but I can't understand how to think about them. Sure, they are just "double" functors, that are contravariant on the first type argument and covariant on the second one, but how the hell should I understand why Strong profunctors form lenses, and Choice ones form prisms, e.t.c.? Even this video, where there are only UpStar profunctors disguised as regular functions, was hard to wrap my head around.

u/ElCthuluIncognitoin r/haskell • Mentions

Anybody have a copy of the "Lenses, Folds, and Traversals" slides PDF? I've been following along Edward Kmett's presentation "Lenses, Folds, and Traversals", and there was a PDF document with the slides available that I was putting to good use to 'decipher' the presentation and learn a lot from it. It used to be available from the link in the video description but it's now a dead link. Does anyone have a copy or know of an alternative source for the PDF laying around?