Shoehorning dependency injection into a FP language - What does it take?
summary
Shows a concrete DI implementation for Unison that uses Unison abilities and handlers to resolve components from an overrides map, constructing values lazily and storing them in a dynamic any while tracking types with phantom sets. Achieves type-checked wiring and targeted overrides, records which constructors cause IO or state, and detects cycles only at runtime. Requires four boilerplate declarations per component, works end-to-end, and a Haskell variant with richer meta‑programming reduces the remaining friction.
AI-written summary · about
chapters (12)
- 0:00Introduction
- 0:45Why mix dependency injection with FP
- 10:14Good DI criteria
- 15:11Unison overview
- 19:05Abilities and effects
- 23:21Bank account service
- 27:56Implementing dependency injection in Unison
- 32:30Library support
- 37:07Why it works
- 41:48Meta programming improvement
- 44:37Call to designers
- 45:38Q&A
related talks
28mUnison, from a Scala perspective
27mDemystifying Dependency Injection Containers
45mInversion of Control Containers Beyond Constructor Injection
24mDependency Injection at Scale
01h 02mRefactoring C++ Code for Unit testing with Dependency Injection
19mPractical Structure to Configure Dependency Injection in Swift
29mDIY Dependency Injection with Kotlin
43mDependency Injection Pattern for iOS App
