Encoding Async Graphs with Dependent Types
summary
A small Scala library called impromptu encodes async task DAGs in types by using singleton intersection types to represent each node s dependency set and an implicit end token to guarantee a node s inputs are evaluated before its body runs. A contravariant dependency wrapper forces the compiler to infer greatest lower bounds (intersection types). Implementation uses lazy futures, prevents unsafe get calls at compile time, is about 30 lines of code and is Apache licensed on GitHub.
AI-written summary · about
chapters (6)
- 0:00Start
- 6:19Chained futures (2)
- 15:23Type parameters
- 21:43Intersections of singleton types
- 32:23Contravariance to the rescue!
- 53:38Real world example
related talks
44mFunctional Interpreters and You
01h 01mAsync injection
01h 01mAsync injection
30mDotty and types: the story so far
31mBoring use cases for exciting types
42mFunctional interpreters and you
53mKleisli, a Friend Who Means You Well
18mGraph IRs for Impure Higher-Order Languages: Making Aggressive Optimizations Af...
