Hacker News new | ask | show | jobs
by sirwhinesalot 855 days ago
I never suggested calling FileExists separately, no idea where you got that from. The article explicitly refers to modeling the codomain of the function accurately, in this case something like Result<File, FileError>
1 comments

> I never suggested calling FileExists separately, no idea where you got that from.

I got it from this:

>>> (i.e., file might be missing, remember to check)

What did you mean by "remember to check"?

You can't use the Result sum type without first checking if it is the valid case or the error case. The type system won't let you forget to check. it's reminding you with red squiggles in your IDE. This is a good feature to have.