[darcs-devel] darcs patch: format error to be easier to read

Ian Lynagh igloo at earth.li
Tue Jun 7 16:15:23 PDT 2005


Hi Mark,

On Sat, Jun 04, 2005 at 11:15:53PM -0000, Mark Stosberg wrote:
>   
> +                  (pinf, Nothing) -> errorDoc $ text "Couldn't read patch:\n"
>                                              <+> human_friendly pinf

It's best to avoid putting '\n's in Docs by hand, but to use $$
(read: "above") instead. So this would be:

    (pinf, Nothing) -> errorDoc $ text "Couldn't read patch:"
                               $$ human_friendly pinf

This means that if the Doc is indented with

    prefix "    " d

, say, then all lines will be indented correctly. (OK, so we can see it
doesn't matter here because we pass it straight to errorDoc, but I think
it's still good practice to do it right).

Also, <+> (as opposed to <>) puts a space before its second argument. If
you want the patch info indented then it's better to use prefix as above
so that all lines get indented.

> +    errorDoc $ text "Couldn't read patch:\n"
>              $$ human_friendly pinf

This one will give a blank line. If you really want that then there
should be a
    $$ text ""
in the middle instead of the \n.


Do you want to fix thit patch up, or would you prefer I did it?


Thanks
Ian





More information about the darcs-devel mailing list