Simple Functional Effects with Tag Unions
summary
A simple effect system built on tag unions (available in Roc and via OCaml polymorphic variants) models I/O as an operation list so HTTP, file-read and file-write tasks keep their precise error types yet automatically accumulate errors for exhaustive pattern matches. Example: a package-downloader composes http.getBytes, file.exists and file.writeBytes into a simulatable state machine that can be logged and tested without real servers. Prototype type-checked; full runtime implementation is pending but expected to be as efficient as Rust async with minimal allocations.
AI-written summary · about
chapters (17)
- 0:00Introduction
- 0:54Package Downloader
- 1:57Download tarball
- 6:05What is an enum
- 7:36Using an enum
- 8:22Advantages of enums
- 10:54GetEncoding
- 12:21Logging
- 14:22Tag Unions
- 15:34Tag Union Types
- 27:46William Brandon
- 28:26Operation
- 31:44Simulation
- 34:03Task wrapper
- 37:49Runtime representation
- 40:01No Heap allocations
- 40:18Summary
related talks
50mFunctional Programming with Effects
43mFunctional Programming with Effects
32mEffective Programming in OCaml
33mExtensible Effects: A Leaner Cake for Purely Functional Code
30mTroll Driven Development: Implementing Functional Effects by Way of Self-Lobotomy
14mFundamentalist Functional Programming
58mEffect-Oriented Programming
28mA Series of Unfortunate Effects
