Skip to content
0:00 / 0:00

#monadtransformers#lenses#profunctors

Edward Kmett - Monad Transformer Lenses

Monadic Warsaw

1K subscribers • 5 videos on Hallway

YouTube
  • Recommended by 2 people: 2 in engineering communities.
  • Presented by Edward Kmett

Advanced. Deep dive for people who know the field.

7.4K views10 years ago2 recommendations

Programming languagesSoftware designHaskellFunctional programmingPerformance and optimization

Edward Kmett discusses building a monoidal category of monad transformers and using lenses on this category to produce highly efficient Haskell code.

I'll talk a bit about how we can do lenses in much more general settings. Then, given that the venue is "Monadic Warsaw" I'll show how we can build a monoidal category of monad transformers and work with lenses on this category with an eye towards how this can let us produce much more efficient code than we can with just the MTL classes as we know them today. No real prior exposure to lenses is required, and all talk of profunctors and the like should be self-contained, but some basic understanding of monad transformers would be helpful.

Why it's here

2 people recommend this

What people say. Recommended as an advanced exploration of monad transformers and optics for performance optimization.

u/b4zzl3in r/haskell • Recommends

Edward Kmett - Monad Transformer Lenses

u/gozesin r/haskell • Recommends

Monad Transformer Lenses

u/tomejaguarin r/haskell • Mentions

Monad transformer optics Yesterday I asked a question about a certain form of commutation operation for monad transformers. I've followed it a bit further and (re)discovered that you can make optics for monad transformers. See the source file on my GitHub account for full details, but as a taster, ``` type a ~> b = forall r . a r -> b r type LensLike f s (t :: * -> *) a b = (a ~> f b) -> (s ~> f t) type ASetter s t a b = (a ~> IdentityT b) -> (s ~> IdentityT t) lensIdentity :: (MFunctor t, Monad a, Monad b) => (a ~> t b) -> (IdentityT a ~> t (IdentityT b)) affineState :: (MonadTrans t, MFunctor t, Monad (t (StateT s b)), Monad a, Monad b) => LensLike t (StateT s a) (StateT…