3 ms·
That's great, you just explained why ADTs are superior to booleans. My question was why are ADTs the same as booleans?
by mrkeen 3y ago
That's great, you just explained why ADTs are superior to booleans. My question was why are ADTs the same as booleans?
- nivertech 3y agoI didn't wrote that ADTs are the same as boolean, only that optional types (Maybe/Option) are the same. For 2 reasons: 1. the 2-case, so it will be harder to refactor once you add additional cases 2. they're missing domain/context/intent (Why value is missing?) So, Maybe/Option is an improvement over null/nil and boolean flags, and ADTs/FSMs are improvement over Maybe-s.