Richard A. Eisenberg
Weekly Video Series
During much of my time at Tweag, I
produced weekly videos about Haskell. They are
on Tweag's YouTube page.
Since leaving Tweag, I do this
more sporadically. My videos are linked below.
- Java has monads, too!, as this video demonstrates.
- An introduction to GHC's -XRebindableSyntax extension.
- A review of the three different mechanisms in GHC for type-aware programming: Typeable, Data, and Generic.
- Deep subsumption: What it is, why it's bad, why we removed it, and why we restored it.
- How to use hs-boot files to make mutually recursive modules.
- How impredicative types can be used to
power part of a JSON parser.
- An introduction to record update syntax, including some complications around type-changing record update.
- The monomorphism restriction causes order dependence. Oh, Haskell.
- A series on implementing a Wordle guess assistant
- Video 1: Design considerations
- Video 2: Cabalizing; importing word lists; some light performance measurement
- Video 3: Encoding the state of a Wordle game
- Video 4: Responding to a guess and advancing the Wordle state
- Video 5: Adding a testsuite with tasty, HUnit, QuickCheck, and CI
- Video 6: Refining our definitions to improve correctness
- Video 7: Fixing respondToGuess
- Video 8: Actually finding the best guess
- Video 9: Optimizing by overloading a function
- Video 10: Using criterion to measure the time elapsed in a function
- Video 11: Lessons learned during this series
- Jan 21, 2022: I explain GHC's deferred type errors feature.
- Jan 14, 2022: UndecidableInstances is meant to say that GHC might loop while compiling. But
it can cause a run-time loop, as I demonstrate.
- Jan 7, 2022: GHC defaults the representation of types at some pretty strange places, as I explore in this video.
- Dec 28, 2021: I puzzle through making a arity-polymorphic unboxed tuple operator, with lots of type-level shenanigans.
- Dec 23, 2021: Why -XNoPolyKinds is a bug and should be removed from GHC.
- Dec 17, 2021: A guide to GHC's pattern-match warnings.
- Dec 10, 2021: A not-so-quick tour of the Quick Look algorithm for impredicative type inference.
- Dec 1, 2021: It's hard to use System.Random.uniform without the monomorphism restriction enabled, as I explain.
- Nov 23, 2021: Emacs's smerge-mode is amazing for helping make merge conflicts disappear. Watch me demonstrate.
- Nov 16, 2021: I reflect on the recent proposal to remove (/=) from the Eq type class.
- Nov 11, 2021: A discussion of the four deriving strategies that GHC can use.
- Nov 2, 2021: GHC's redundant-constraints warning has a bug in it, and this video explores the bug and the challenges in fixing it.
- Oct 28, 2021: I describe the principles behind a recent proposal for an update to scoped type variables.
- Oct 19, 2021: I walk through the TypeError facility in GHC to customize type errors.
- Oct 14, 2021: I explain why let should not be generalized,
the subject of the MonoLocalBinds extension.
- Oct 7, 2021: This video shows how to make pattern synonyms that expose a safe interface to an unsafe, efficient data representation.
- Sep 28, 2021: I describe how GHC compiles pattern synonyms into pattern synonym matcher functions.
- Sep 21, 2021: Continuing about pattern synonyms, I explain their type signatures.
- Sep 15, 2021: I introduce pattern synonyms, a powerful feature in GHC allowing abstraction over patterns.
- Sep 8, 2021: I walk through the process of instance selection, including a little on overlapping instances.
- Aug 31, 2021: I describe the process for getting the existentials paper published at ICFP.
- Aug 24, 2021: This video describes how GHC generalizes definitions that lack type signatures.
- Aug 18, 2021: Building on the last video, this one introduces proper levity polymorphism.
- Aug 12, 2021: An introduction to the way Haskell tracks type representations in its kinds, warming up to an exploration of levity polymorphism.
- Aug 4, 2021: Unboxed tuples in Haskell, and how they can make programs allocate less memory.
- Jul 28, 2021: More about Haskell's kinds, exploring two examples of types with fancy kinds.
- Jul 20, 2021: An introduction to Haskell's kind system.
- Jul 13, 2021: Some work on getting rid of Derived constraints means a change in what constraints GHC generalizes. I explore the details.
- Jul 7, 2021: I write an arity-inferred version of
zipWith
,
with lots of type-level hackery on the way.
- Jun 29, 2021: A more newcomer-oriented video, I walk through some basic type
error messages, explaining what they mean.
- Jun 22, 2021: An introduction to
Coercible
, a feature
that makes it possible to optimize code that works with newtype
s.
- Jun 15, 2021: GHC sometimes infers the wrong type.
- Jun 8, 2021: An introduction to the
DerivingVia
extension,
which can allow you to avoid writing boiler-plate class instances.
- Jun 1, 2021: An introduction to type-checker plugins, which can
allow you to extend GHC's type checker to cover cases never conceived by us designers of GHC.
- May 25, 2021: I debug a performance problem live in GHC, on camera. You can
watch how I organize such a session and tackle the problems that come up.
- Apr 13, 2021 - May 18, 2021: A series of videos on type-level programming in Haskell, demonstrating GADTs, type families, and other fun features.
The videos can be watched independently, but for best results (for programmers less experienced in type-level programming), watch in order.
- Apr 13, 2021: Generalized algebraic datatypes (GADTs) and length-indexed vectors
- Apr 20, 2021: Singletons and
replicate
- Apr 27, 2021: Type families
- May 4, 2021: Existentials
- May 11, 2021: Proofs
- May 18, 2021: Writing custom GADTs to capture arbitrary invariants
- Apr 6, 2021: A small introduction to
ScopedTypeVariables
and
its quirks.
- Mar 30, 2021: The IO monad is really just a state monad, passing
around the entire
RealWorld
as its state.
- Mar 23, 2021: The dreaded monomorphism restriction can actually
improve performance.
- Mar 15, 2021: GHC does not support infinite types. Yet the mere possibility of these
prevent closed type families from reducing.
- Mar 8, 2021: Newtypes are not strict datatypes, debunking a myth I believed until recently.
- Mar 1, 2021: The GHCi command
:type +d
allows you to default a type – very useful in instructional settings.
- Feb 22, 2021: Using closed type families to simulate closed classes. This video explores a folklore trick to using a closed type family to avoid overlapping instances.
- Feb 15, 2021: Why
let
-generalization is confusing, especially because GHC sometimes chooses not to do it.
- Feb 8, 2021: How to optimize Haskell, exploring a previous blog post of mine.
- Jan 25, 2021: Connecting linear types to dependent types via relevance. Unlike most other videos, this one focuses on a research paper I co-authored (with Pritam Choudhury, Harley Eades, and Stephanie Weirich). It focuses more on the Haskell of the future than the Haskell of today, and includes a little Idris programming.
- Jan 18, 2021: How whitespace works in Haskell. This video is much more of an instructional one than many, demonstrating how whitespace-sensitive parsing works in Haskell.
- Jan 11, 2021: Functional dependencies are inconsistent, as this video demonstrates.
- Jan 4, 2021: Type families can get stuck on invisible arguments, as this video shows. If you have a poly-kinded type family that isn’t reducing, you may want to look here.
- Dec 28, 2020: Break out of Template Haskell and into the type-checker. This video demonstrates how a sneaky Template Haskell user can access the full type-checker context, though doing so is dangerous.
- Dec 21, 2020: Roles can break abstraction, because an abstract type with a class-based invariant might still be coercible to a different type that will violate the invariant. The video shows how this can happen.
- Dec 14, 2020: Strict variables assignments are not bang patterns, as this video shows.
- Dec 7, 2020:
DeriveAnyClass
considered dangerous. This video demonstrates why I do not recommend enabling the DeriveAnyClass
extension by default.
- Nov 30, 2020: Fixing a GHC bug around equality constraints, demonstrating some of the gnarly bits of GHC’s constraint solver.
- Nov 23, 2020: Using linear types to require the use of a token. the example imagines bringing a certain quantity of money into scope; linear types prevent us from losing or duplicating the money.
- Nov 16, 2020: Rewriting with loopy equalities explores how we might use an assumption like
a ~ UnMaybe (Maybe a)
for rewriting, even though it looks like using that for rewriting will cause infinite regress.
- Nov 9, 2020: Non-confluence in the solver means that type inference can be unpredictable. And yet this happens! It means we can write a program whose runtime behavior depends on the order of constraints written in a type.
- Nov 2, 2020: A type inference challenge around using constraints to implement “fake” type families. The trick to get the example accepted is to introduce an ordering constraint on how certain constraints are solved.
- Oct 26, 2020: How impredicative types and type families don’t mix, demonstrating how GHC’s new Quick Look algorithm stumbles over type families sometimes.
- Oct 22, 2020: Debugging an assertion failure in GHC’s constraint solver. The video includes a brief introduction to some of the details of the constraint solver, around Givens, Wanteds, and Deriveds. You can watch how some of the magic happens in debugging GHC itself. (I forgot to make my font size big for this one – apologies!)
- Oct 14, 2020: Why we can’t yet eliminate
Proxy
. Briefly, because Haskell does not yet allow visible type application in lambda-expressions that might be used in higher-rank contexts.
- Oct 14, 2020: Hello, World!, where I briefly introduce the video series.
Production notes
I record these videos using OBS Studio, with very light editing in DaVinci Resolve. Recording, editing, and posting often add up to take 30-40 minutes of time, much of which is spent waiting for rendering (and can be parallelized with other work). Time to prep for a video ranges from no time at all to maybe up to an hour, if there is some tangled code involved. The goal in production is expedience over a polished result, meaning we all get to enjoy more videos, at the cost of sometimes a few glitches. In particular, I’m aware that sound quality would be improved with a boom mic, but I can’t imagine restraining myself from moving around while making the videos – something tangible would be lost.
The upshot here is that you too can make such videos: my headset (Logitech G332, highly recommended) was under $50 (though I then graduated to a Shure MV7 at a higher price point), and the recurring time investment is quite low. (It took me maybe a day to learn enough about OBS and DaVinci Resolve, with credit to my Tweag colleague Steve Purcell for introducing me to DaVinci Resolve.) And making the videos is definitely fun.