Skip to content
0:00 / 0:00

#profunctors#optics#lenses

Deconstructing Lambdas—An Awkward Guide to Programming Without Functions

Berlin Functional Programming Group

2K subscribers • 8 videos on Hallway

YouTube
  • Recommended by 2 people: 2 in engineering communities.
  • Presented by Chris Penner

Advanced. Deep dive for people who know the field.

5.5K views5 years ago2 recommendations

Programming languagesComputer scienceHaskellFunctional programmingComputation and complexity

Chris Penner explores how profunctors and profunctor transformations serve as foundational computing tools by expressing programming patterns without functions.

With Chris Penner! We'll explore how profunctors are a foundational computing tool by expressing many programming patterns using the profunctor class hierarchy and profunctor transformations (a.k.a. hypermorphisms, a generalization over profunctor optics). Chris Penner is a Haskell hobbyist and self-proclaimed incarnation of "Cunningham's Law". He enjoys writing and often blogs about Lenses, Representable Functors, Monoids, and everything in between. He recently wrote "Optics by Example", a compendium on the elusive art of lenses, prisms, traversals, and their applications in functional programming. In his spare time, you can find him in the park doing handstands or writing Progressive Metal tracks on his 1989 Nintendo Gameboy. Slides for this talk: dropbox.com/s/1gxkl8x9pwh2muy/deconstructing-lambdas.pdf?dl=… This virtual talk was brought to you by the Berlin Functional Programming Group. Join us on Meetup: meetup.com/Berlin-Functional-Programming-Group/ Follow us on Twitter: twitter.com/BerlinFPGroup Buy a T-shirt: teespring.com/berlin-fp-group Support us on Patreon: patreon.com/bfpg

Why it's here

2 people recommend this

What people say. Recommended as a deep dive into profunctors and functional programming concepts in Haskell.

u/sohang-3112in r/haskell • Recommends

Deconstructing Lambdas—An Awkward Guide to Programming Without Functions

u/ysangkokin r/haskell • Recommends

Deconstructing Lambdas—An Awkward Guide to Programming Without Functions

u/Simon10100in r/haskell • Mentions

On “Code generation with Haskell itself as the DSL”

…ers like Z3). You can **only use the functions provided** for `SBV` since its **constructor is not exported**. This way is my recommended approach since it's relatively easy. I would try this and see if this gets you far enough for your purposes. - You can use concepts from categories, profunctors,... to create a DSL for functions. Here is a great link to this video which explains this in detail and builds a prototypical DSL for Javascript functions. - One step further is then (Compiling to Categories)https://github.com/compiling-to-categories/concat which tries to make the previous approach more convenient. It aims to overload any Haskell function from `a -> b` into a `Category a b`. Then, typeclass…

u/ChrisPennerin r/haskell • Mentions

On “Looking for Feedback on Array-Traversal Construct”

Have you looked into profunctor encodings of computations? You would express your computation as a `p a b` profunctor, then you can provide additional power via constraints. E.g. you can write a `ProfunctorReader` class to provide things like the input array or the current index. The ability to run over multiple data is provided by the `Traversing` class, the requirement for state or side effects can be encompassed by using a concrete `Kleisli`, or alternatively by using `Representable` constraints. You can even encode the ability to perform fixed points or loops using profunctor constraints as I discuss here: Deconstructing Lambdas—An Awkward Guide to Programming Without Functions

u/barsoapin r/compsci • Mentions

On “How important is the principle of explosion of classical logic in CS?”

It's essential: The sum monoid of a cartesian closed category relies on it and without CCC, there would be no lambda calculus (and not a lot of things in general). Have some very hackish haskell yoga. Note `Absurd`, which is a morphism from the empty type to any type. Without you couldn't go from `Either Void a` over `Either a a` to `a`. The tl;dr of that is that without the principle of explosion, you won't get it to typecheck. Of course it doesn't have any computational meaning because, well, you cannot construct values of the empty type, but that doesn't mean that it's not necessary: That it is impossible is the very point, a value of type `Either Void a` can never be a `Left`, it's alwa…

u/circleglyphin r/haskell • Mentions

On “Are there books for code smell / refactoring for functional programming languages?”

…e doesn't mean we weakened our opinions and claims. My personal opinion is that the rot set in with thinking that programming languages have grammatical constructs similar to human languages, composed from things like nouns and verbs (objects and methods, say). It used to be the case that we just dismiss each design principle as just functions: [video But some of us think that functions are problematic: [video The search for perfection continues! \> replacing a loop with a monad (or vica verca). We traverse applicative functors: http://www.cs.ox.ac.uk/jeremy.gibbons/publications/iterator.pdf…

u/RobertPeszekin r/typescript • Mentions

…cross-compilation to another language, allowing developer to write proofs in say COQ for some Haskell code (I never done it). This has some of the feel of the old UML. Some special purpose language agnostic tools like TLA+ (Lamport's tools for reasoning about distributed code) exist too. A super interesting idea was presented by Chris Penner (link to this video Very roughly think about functions as an abstraction without blows and whistles included. If you know the concept of Arrow think about _Arrow_ without the _arr_ (without ability to make any pure function into an arrow). This idea could lead to some very interesting cross language developments. But I am unaware of any progress on this.…

u/elvecentin r/haskell • Mentions

On “How do I write a Hedgehog generator for a wrapped function?”

In this particular case, I would recommend simply proving the laws on paper. Generally speaking, it's hard to do something with functions other than writing them by hand or applying them to arguments. While generating arbitrary functions is probably impossible, what you can do is generate some syntax trees that are then evaluated into functions. Check out this talk by Chris Penner to learn more link to this video

u/blankhartin r/haskell • Mentions

On “Any good material about how to think about and use profunctors?”

link to this video