Open mjepronk opened 6 years ago
It seems reasonable, however, I've resisted for a few reasons:
readFile
? It can indeed throw errors.Partial =>
annotation would be a much better approximation.Solution is to have a group in .hlint.yaml
which is off by default, then people can turn on a warning of groups of partial functions. I'm happy for someone to contribute this.
Probably good to start with the list in https://wiki.haskell.org/Avoiding_partial_functions
I think one important distinction to make is partial pure functions and partial impure functions. If you're in IO
, you'll probably expect operations to fail, not as much so in pure code. readFile
is kind of a corner-case though, since it is lazyIO, which can cause crashes in pure code.
Having a warning for lazy-IO functions as a separate set would be possible. I leave it to what people want to contribute.
Would it be an idea if HLint would warn about partial functions like
head
?Of course the list should be hardcoded (since there is no way to automatically identify them).
I couldn't find if this has been discussed previously, so sorry if it was.