|
|
|
|
|
by yummyfajitas
4962 days ago
|
|
If a programmer is incapable of doing this: maybeGetFileHandle :: FilePath -> IOLikeMonad (Maybe Handle)
Why do you think they are capable of doing this? foo :: FilePath -> IOLikeMonad (Maybe Handle)
-- If the file is available and can be read
-- return Some handle. Otherwise, return None.
|
|
Of course, this doesn't apply to all comments - but specifically those insane policies where you're required to write a description of every method, argument and return type.
The more powerful the type system, the less necessary comments become. If you take a dependent type system for example, or some code contracts with explicit preconditions, you no longer need to specify the valid range of values for a given function in some silly comments which will fall on deaf ears in the majority of cases anyway. The programmer will be stopped and forced to read it, rather than waiting until runtime to discover the correct behavior, if at all.