> Following up on review. Note sure if this is strictly better. The
> duplication is removed but the code is a perhaps harder to read now.
I think if it is harder to read, it's because of the use of 'maybe'
rather than an explicit case.
If you changed
check_badname n =
if null n then
fail "The patch name must not be empty!"
else if "TAG " `isPrefixOf` n then
fail "The patch name must not start with \"TAG \"!"
else
return ()
into
check_badname n =
case just_a_badname n of
Just err -> fail err
Nothing -> return ()
Then I think it'd be very clear.
check_badname = maybe (return ()) fail . just_a_badname
is obviously equivalent when we think about it, but perhaps a bit harder
to immediately follow. (But either is fine with me)
|