Skip to content
0:00 / 0:00

#finallytagless#mtl#dsl

LambdaConf 2015 - Finally Tagless DSLs and MTL Joseph Abrahamson

Confreaks

42K subscribers • 85 videos on Hallway • Conference channel

YouTube
  • Recommended by 2 people: 2 in engineering communities.
  • Presented by Joseph Abrahamson

Advanced. Deep dive for people who know the field.

5.6K views10 years ago2 recommendations

Programming languagesSoftware designHaskellFunctional programmingDesign patterns

Joseph Abrahamson explores Finally Tagless DSLs as an embedding technique and shows how the Haskell MTL library utilizes this style.

Finally Tagless DSLs are a DSL embedding technique pioneered by Oleg Kiselyov, Jaques Carrette, and Chung-Chieh Shan that is in some sense "dual" to the notions of free-monad interpreters. MTL is a very popular monad library in Haskell which just so happens to be, unbeknownst to most, a Finally Tagless DSL itself. This talk explores what the Finally Tagless DSL style offers and shows you can use that concept to extend your effect-typing vocabulary in MTL. Help us caption & translate this video! amara.org/v/HdYG/

Why it's here

2 people recommend this

What people say. Recommended for understanding the relationship between MTL, Free Monads, and Finally Tagless DSL architectures.

Moments people linked to

u/gelisamin r/haskell • Recommends

On “Is there any reason why mtl-style is focused on having a Monad constraint in its classes?”

Probably for historical reasons. Applicatives compose nicely, as witnessed by the Applicative instance for `Compose`. Monads don't compose so nicely, which is why we need Monad transformers. And the API for Monad transformers requires a lot of calls to `lift`, which some people find annoying. So, the Monad Transformer Library (mtl) was created, using type classes to determine how many calls to `lift` are needed and to add them automatically using type inference and instance resolution. Since the intent is to use an mtl-constrained type instead of a concrete Monad transformer stack containing the same pieces, it made sense for the mtl type to provide the same API as the concrete Monad transf…

u/Platzin r/haskell • Recommends

On “How do I get up to speed with the Free approach?”

MTL lets you separate logic from actions too. MTL also lets you vary the interpreter. The only thing Free Monads give you above this is *the ability to inspect/modify the syntax tree of the computation prior to evaluating the computation*. https://www.reddit.com/r/haskell/comments/3yksmn/a_modern_architecture_for_fp/cyh9489 link to this video MTL is a very popular monad library in Haskell which just so happens to be, unbeknownst to most, a Finally Tagless DSL itself, which is in some sense "dual" to the notions of free-monad interpreters. Basically, unless you're going to inspect/modify the syntax tree of the computation prior to evaluating the computation (i.e. to view or substitute nodes in the p…

u/Platzin r/haskell • Recommends

On “Do Free Monads Actually Matter?”

I believe tel demonstrates this (inhabit the typeclass with arbitrary syntax) (with mtl) here link to this video
5View on Reddit

u/Platzin r/haskell • Recommends

On “I want to write a configuration management system in haskell.”

Also this video, but it does go into some of the nuances that may or may not be important here: link to this video