[darcs-users] darcs patch: Appease ghc -Wall in Setup. (and 3 more)

Trent W. Buck trentbuck at gmail.com
Mon May 25 03:34:32 UTC 2009


On Sun, May 24, 2009 at 09:31:57PM +0200, Petr Rockai wrote:
>> -quote :: String -> String
>> -quote s = "\"" ++ s ++ "\""

>> -              [define "PACKAGE_VERSION" $ quote version,
>> -               define "PACKAGE_VERSION_STATE"  $ quote state]

>> +  let args = ("-DPACKAGE_VERSION=" ++ show version) :
>> +             ("-DPACKAGE_VERSION_STATE=" ++ show state) :

> The quote function has a much better type for this use case IMHO
> (avoids mistakenly quoting a non-string). There used to be some
> show-related bugs some point. (Although this looks safe, but I'd
> argue that it makes future refactoring a little harder.)

Quote's definition is wrong if the source string contains quotes,
backslashes, newlines, etc.  Currently the version strings don't, but
I wanted to future-proof against it.

If show's type is a concern, we can have this, though it seems
unnecessary to me.

    quote :: String -> String
    quote = show


More information about the darcs-users mailing list