>> * better error handling when applying patches
>
> OK. I was wondering whether it's good advice to suggest
> "darcs repair" without being sure of the cause of an error,
> but if the repo is not broken it should be harmless.
You have a point here, in that darcs repair potentially modifies patches (without
changing their identity), and there may be corner cases where this can cause harm
or at least confusion. There are many ways in which we could improve the repair
command to guard against this, but this is a separate discussion. Perhaps I'll
open an issue for that.
>> + Just _ ->
>> + throw $
>> + flip ioeSetErrorString "is a directory" $
>> + mkIOError InappropriateType "readFile" Nothing (Just (displayPath p))
>
> I had to poke around briefly to convince myself that we can't get `Stub` here
> (because of the `expandTo` call in `findItem`). Maybe it'd be more defensive
> to look for `Just (Subtree ...)` instead and have another fallthrough case?
> But maybe that's overkill.
There are lots of places (in that module) where we make this assumption. So, not a
bad idea per se, but if we do that we should revisit all functions in this module
and that's out of scope here.
>> * TreeMonad: add two comments and some code re-formatting
>
>> +-- TODO It is unclean to throw exceptions from potentially pure code.
>
> I think this depends on whether we expect to catch them or not. If we expect
> them to abort the program, or at the very least to be caught in IO without
> a strong expectation of _which_ exception will be thrown (as per "A Semantics
> for Imprecise Exceptions"), I don't think it is unclean.
I'd like to argue that if you have to make assumptions on how things are used,
then there is already something "unclean" with your design. (Not that we adhere to
such a strict standard everywhere else in Darcs, so go ahead and call me a
hypocrite.) In any case, the point is moot insofar as with
patch c2737fa99e15af26c36602ec445ffeb4a10db25d
Author: Ben Franksen <ben.franksen@online.de>
Date: Sun Sep 19 14:00:41 CEST 2021
* require MonadThrow from the base apply monads
(which is in screened) we have a completely clean solution.
|