[email protected]
[Top] [All Lists]

Re: [Haskell-cafe] Re: Allowing hyphens in identifiers

Subject: Re: [Haskell-cafe] Re: Allowing hyphens in identifiers
From: Ben Millwood
Date: Wed, 16 Dec 2009 15:45:01 +0000
On Wed, Dec 16, 2009 at 2:55 PM, Daniel Fischer
<[email protected]> wrote:
> unCamel :: String -> String
> unCamel ('<':cs) = '<' : inTag cs
> unCamel (a:b:c:cs)
>    | isLower a && isUpper b && isLower c = a : '_' : toLower b : c : unCamel 
> cs
> unCamel (a:[email protected](b:cs))
>    | isLower a && isUpper b    = a : '_' : b : unCamel cs
>    | otherwise                 = a : unCamel bs
> unCamel cs = cs

Excuse my pedantry, but: writeToList -> write_toList.
I think the third equation needs to be:

> unCamel (a:b:[email protected](c:_))
>  | isLower a && isUpper b && isLower c = a : '_' : toLower b : unCamel cs

so that the third character is not ignored in subsequent parses.

By the way, I like camelCase because I think that in most cases you
*don't* want to break identifiers up into their component words - you
read and understand what the function does once, and then you use it
as a word in its own right. Any resemblance to actual English is
really just a mnemonic of sorts.
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

<Prev in Thread] Current Thread [Next in Thread>