On 29 February 2012 18:41, Andreas Brandt <bugs@darcs.net> wrote:
>
> New submission from Andreas Brandt <andreas.brandt.de@googlemail.com>:
>
> I also added some comments to make it easier to understand for
> newcomers like me.
>
> 1 patch for repository http://darcs.net/screened:
>
> Wed Feb 29 19:19:44 CET 2012 Andreas Brandt <
> andreas.brandt.de@googlemail.com>
> * Refactor: Extract function for handling extra arguments
>
Hi Andreas,
Thanks for the patch! A few comments (I've inlined parts of your patch):
> + case extraArgumentsMatch extra cmd msuper of
> + (True, _) -> runWithHooks specops extra
> + (False, msg) -> fail msg
I see that you're just throwing away the string in the True case. That
suggests
to me that you should use (Maybe String) as the return type, and that you
should run the command when there is Nothing as the error message. (Maybe
the
function should be called extraArgumentsError or something, to make sense of
the result type).
> + nth_arg n = nth_of n (commandExtraArgHelp cmd)
> + nth_of 1 (h:_) = h
> + nth_of n (_:hs) = nth_of (n-1) hs
> + nth_of _ [] = "UNDOCUMENTED"
> +
I notice this function was previously defined in the file, but it'd be good
to
use this opportunity to translate from underscore_identfiers to
camelCaseIdentifiers.
Cheers,
Owen.
Attachments
|