Boolean Blindness Explained for Beginners in Haskell
summary
Argues that Booleans are an information-poor type and shows concrete fixes in Haskell: replace Boolean flags with pattern matching, custom ADTs or Maybe/Either return types to make functions total, pass decision logic as functions instead of flags, and compose predicates with a fold using the reverse bind to short‑circuit. Examples include a safer list append, turning a partial lookup into a Maybe result, and a scalable validate pipeline; the compiler then prevents the common mistakes described.
AI-written summary · about
chapters (27)
- 0:00Intro
- 2:38Information Poverty
- 3:35Common Anti-pattern
- 3:57List Append
- 5:36What are the problems?
- 5:52Partial Functions
- 9:11Higher-Kinded Types
- 9:41Maybe as a Return Type
- 11:01Principle
- 12:56Example
- 14:13Solution (Kind Of)
- 14:33Algebraic Data Types
- 17:49Input Validation
- 18:14Replace First Flag
- 18:50Replace Second Flag
- 19:51Maybe as Return Type
- 21:25The Right Section of
- 21:57A Scalable Version
- 22:30Helper Function
- 23:35A Better Helper
- 24:14Let's Use a Monad
- 25:53Reverse Bind for Maybe
- 26:18Using a Monad Instance
- 27:43Data Flow
- 28:57Pretty Cool?
- 29:34Summary
- 35:02First Try At Refactoring
related talks
31mParametricity The Essence of Information Hiding
30mConstraint Typing with Boolean Algebra
15mQualified Types with Boolean Algebras
01h 12mTruth about Types
45mDepending on Types
27mDecomposable Type Highlighting for Bidirectional Type and Cast Systems
01h 43mLiquidHaskell Refinement Types for Haskell
01h 03mHow to use Phantom Types and Existential Types in Production
