[C2hs] Patch: Don't lowercase existing CamelCase

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Sat Jan 24 15:56:05 EST 2009


On Sat, 2009-01-24 at 18:19 +0100, Achim Schneider wrote:
> Agar (http://libagar.org) uses AG_FunctionFoo as naming convention and
> I like to write hooks of the form
> 
> {#fun FunctionFoo as ^ ... #}
> 
> As it stands, though, c2hs-0.15.1 will lowercase the second F,
> unnecessarily.
> 
> I attached a patch against c2hs/chs/CHS.hs that fixes this... I'm not
> completely sure of it, though, as apathToIdent looks like it could be
> important. Anyway, for me the patch does what it's supposed to do.

Thanks Achim.

930,931c930
<     let lowerFirst (c:cs) = toLower c : cs
<     in onlyPosIdent (posOf ide) (lowerFirst $ identToLexeme ide)
---
>     onlyPosIdent (posOf ide) (identToLexeme ide)

This one I don't understand. I don't understand why converting the first
char to lower case is bad here or how it relates to your example.

1086c1085
<     adjustCase (c:cs) = toUpper c : map toLower cs
---
>     adjustCase (c:cs) = toUpper c : cs

This one makes perfect sense to me.

Benedikt, do you agree?

Duncan



More information about the C2hs mailing list