EPISODE · Sep 27, 2021 · 1H 5M
040: Phantom Builder Pattern
from Elm Radio · host Dillon Kearns
Phantom types (happens at compile time, not runtime)Helps avoid things like adding centimeters and inchesianmackenzie/elm-unitsJoël Quenneville's phantom types talk from Elm in the Spring A Number by Any Other NameExtensible recordsBuilder patternJeroen's Hierarchy of Constraintselm-graphql SelectionSet scope type variableBuilder Pattern episodeBrian Hicks' builder pattern talk Robot Buttons from Marswith functionsPhantom builder is a state machine for your typeselm-review Rule API uses phantom builderPhantom types discourse post on time package Simon HertebySnapshot test in Elm review for expected error messagesPhantom Builder live stream episodePossible operations with phantom extensible buildersAdd a new fieldRemove a fieldChange the type of a fieldRemove the previously existing phantom type and change it to an empty record (not extensible, just a hardcoded return type) i.e. ReplaceWhat you can do with phantom builderRequire something to be always calledForbid something being called more than onceCause other constraints dynamically after calling somethingMake function calls mutually exclusiveEnable a function only if another one has been called
What this episode covers
Jeroen introduces the phantom builder pattern and how it enables new guarantees in Elm API design.
NOW PLAYING
040: Phantom Builder Pattern
No transcript for this episode yet