Conversation

The gymnastics you have to do in imperative languages to approximate algebraic data types always feels very strange to me.
Quote Tweet
A few weeks ago we made use of Swift's powerful runtime metadata to compute the "tag" of any enum. Then we realized we could leverage that power to provide a huge performance boost to a critical part of the Composable Architecture 🤯 Learn how 👉 pointfree.co/episodes/ep152
Show this thread
Screenshot of code showing how to use Swift's runtime metadata to compute the tag of an enum.
7
73
Note also that you can model algebraic data types through the use of abstract dataypes (you can even think of them _as_ abstract datatypes in languages that support them) - ie. an abstract type constructor, a bunch of data constructor operations, and a deconstructor operation.
1
2