
On 31/08/2018 18.59, Oliver Charles wrote:
On Fri, Aug 31, 2018 at 5:21 PM Tikhon Jelvis
wrote: Deeper questions of partiality aside, if a function can throw exceptions, the documentation should spell this out *explicitly*, ideally also specifying what the type of the exception may be. To me, this is a *minimum* standard to expect from documentation in any language with exceptions.
Is this to be applied transitively? It has to be, to meet your criteria, but this is a fairly unrealistic expectation to put on library authors. If it's not applied transitively, then the documentation creates a false sense of security - "catch these exceptions that *I* throw and you're good!". I really think this part of exceptions is a tooling problem that we have to solve. Haddock should be responsible for figuring this out.
Not to mention the issues of "may throw" declarations for higher-order functions... (Java checked exceptions are basically broken[1] because of this. Well, this + the variance issues arising from inheritance and method signatures, but obviously Haskell doesn't have inheritance, so...) Regards, [1] They even break "catch" because everybody is forced to wrap "checked" exceptions in a RuntimeException if signatures don't specify "may throw anything", so you *also* have to check for wrapped exceptions in "catch" clauses. Anyway...