[darcs-users] darcs patch: Resolve issue1162: makeAbsolute is now a total function
benjamin.franksen at bessy.de
Sat Mar 28 23:04:42 UTC 2009
Trent W. Buck wrote:
> 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/.
I'll follow up with this. And some more cleanup and docs, see below.
>> 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?
Not w/o further changes (note the following where-clause). But there are
other simplifications I want to make, maybe this one falls out as a side
> Finally, if you understand the functions you're modifying, adding a
> haddock comment for each one would be greatly appreciated.
Will try my best. It's kinda like reverse engineering, really. IMO this
whole file path handling should be re-written from scratch. But for that we
would need some precise spec for what is required by the rest of the
program. I have the feeling nobody knows for sure.
More information about the darcs-users