[darcs-devel] [patch576] Forward-port of a new annotate implement... (and 1 more)

Petr Ročkai bugs at darcs.net
Sun Apr 3 22:34:56 UTC 2011


Petr Ročkai <me at mornfall.net> added the comment:

Hey,

Ganesh Sittampalam <bugs at darcs.net> writes:

>> +instance MonadPlus AnnotatedM where -- :(
>> +    mplus a b = a >> b -- this is wrong, but we can't catch here
>
> I think this should be mplus a b = a, if anything, but you'll be pleased
> to know I've now got rid of the MonadPlus requirement for
> Readable/WriteableDirectory (patch to be submitted soon) so it's not
> necessary at all.

well, I wanted to keep the instance empty, but that fails... Indeed,
mplus a _ = a may be better.

>> hunk ./src/Darcs/Match.hs 440
>>  withRecordedMatch r job = do createPristineDirectoryTree r "."
>>                               readRepo r >>= job
>>  
>> -applyInvRL :: (Patchy p) => RL (PatchInfoAnd p) C(x r) -> IO ()
>> -applyInvRL = applyPatches . invertRL -- this gives nicer feedback
>> +applyInvRL :: (WriteableDirectory m, Patchy p) => RL (PatchInfoAnd p) C(x r) -> m ()
>> + -- we forego feedback here to be able to live in "m" as opposed to IO
>> +applyInvRL = apply . invertRL
>
> Would be nice to keep the friendly behaviour at least when m = IO. The
> IO is used for unsafePerformIO-free progress, for catching errors and
> for printing to stderr. Of course the removal of MonadPlus means we
> can't catch errors in general :-)

I am not very fond of the progress reporting either way.

> What do you think about adding something to WriteableDirectory to
> optionally provide feedback, using something like the below?:

I am a bit wary of that, since it feels a bit like "fail" in Monad. It
may be convenient, but it doesn't belong. I would prefer a MonadProgress
class instead, which would make it fairly easy to provide or not provide
feedback depending on who you are.

Yours,
    Petr

-- 
id' Ash = Ash; id' Dust = Dust; id' _ = undefined

__________________________________
Darcs bug tracker <bugs at darcs.net>
<http://bugs.darcs.net/patch576>
__________________________________


More information about the darcs-devel mailing list