Sveriges mest populära poddar

Elm Radio

040: Phantom Builder Pattern

66 min • 27 september 2021

Possible operations with phantom extensible builders

  • Add a new field
  • Remove a field
  • Change the type of a field
  • Remove the previously existing phantom type and change it to an empty record (not extensible, just a hardcoded return type) i.e. Replace

What you can do with phantom builder

  • Require something to be always called
  • Forbid something being called more than once
  • Cause other constraints dynamically after calling something
  • Make function calls mutually exclusive
  • Enable a function only if another one has been called
Kategorier
Förekommer på
00:00 -00:00