[darcs-users] darcs patch: Resolve issue1162: makeAbsolute is now a total function

Trent W. Buck trentbuck at gmail.com
Sat Mar 28 02:59:50 UTC 2009


Some minor nitpicking:

ben.franksen at online.de writes:
> Sat Mar 28 00:18:21 CET 2009  ben.franksen at online.de
>   * Resolve issue1162: makeAbsolute is now a total function

AFAICT this should also move bugs/issue1162_add_nonexistent_slash.sh
into tests/.

>  simpleSubPath :: FilePath -> Maybe SubPath
> -simpleSubPath x | is_relative x = Just $ SubPath $ FilePath.normalise $ map cleanup x
> +simpleSubPath x | null x = bug "simpleSubPath called with empty path"
> +                | is_relative x = Just $ SubPath $ FilePath.normalise $ map cleanup x
>                  | otherwise = Nothing
>  
>  
>  makeAbsolute :: AbsolutePath -> FilePath -> AbsolutePath
> -makeAbsolute a dir = if is_absolute dir
> +makeAbsolute a dir = if not (null dir) && is_absolute dir
>                       then AbsolutePath $
>                            slashes ++ FilePath.normalise cleandir
>                       else ma a $ FilePath.normalise cleandir

Would makeAbsolute be more readable if it used guard style, as
simpleSubPath does above?

Finally, if you understand the functions you're modifying, adding a
haddock comment for each one would be greatly appreciated.



More information about the darcs-users mailing list