Shoehorning dependency injection into a FP language, what does it take?
This talks shows why dependency injection is important and how to support it in a functional programming language like Unison where the only abstraction available is its effect system.
Targeted overrides
Any partof the graph can be overridden
The same component type can have different implementations
Or all of this
Just this
20.
Targeted overrides
Any partof the graph can be overridden
The same component type can have different implementations
Should this concrete
implementation be specified here?
21.
Effects
Instantiation can beeffectful
Instances can be singletons or not
Singleton is the default
Java = unrestricted effects 🤪
22.
Code at ourfingertips!
Expressivity
Conciseness
Fast, accurate
feedback
What is Unison?
Strongly,statically typed
Haskell-like but
- Strict evaluation
- No type-classes
- No macros
Functional programming language
Immutable code
- Content-hashed
- Stored in a database With an effect system!
25.
Unison Cloud
No ORMfor persistence
Deploy services with code!
- Abstract notion of Location
- Run locally for testing
- Easy rollback / versioning
Services communicating with no JSON
Distributed code
- Services / daemons
- Pipelines, KLogs (distributed streaming)
Do better inUnison?
Override component effects
➕
=
Collect function types: parameters + effects
50.
Do better inUnison?
Full dynamic types
It’s functions all the way down
51.
Do better ideally
Meta-programmingDecompose / apply functions
Custom compiler errors Stack can become large
(Efficient) type-level sets https://xkcd.com/303
Good inference options =
if prod then … else …