|
|
|
|
|
by badbath
4235 days ago
|
|
That's nuts. All of your code now has to check if err != nil, etc. Furthermore, the sendEmail and validateEmailForm values are essentially ignored and used only for their possible error values. Why should I wrote my program as if the thing I'm concerned primarily with is errors? Much better to encode the failure into the type. You could have, for example, some function that returns Either[Error, SendEmailAction] where SendEmailAction is a function that, when called, will perform the effect of sending an email. Now I can deal with the happy path by mapping on the right-biased Either. |
|