Closed bytesource closed 2 years ago
It was mainly for brevity but there wasn't any obvious benefit in these cases (function outputs) from using something more complex. Converting them into single-case DUs is relatively easy should you feel the urge to do so.
Thanks, that makes sense. I converted Total
to a single-case DU, but kept DiscountPercentage
as a type abbreviation, as in the example code it's only used internally.
Hi Ian,
After you mentioning the problems with type abbreviations compared to (private) singe-case discriminated unions, I wonder why you chose type abbreviations for
Spend
andDiscountPercentage
on page 128:Was this merely to keep the book code a bit shorter, or is there something else I should keep in mind?
Still enjoying your book!
Cheers,
Stefan