[email protected]
[Top] [All Lists]

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

Subject: Re: [Haskell-cafe] Re: Allowing hyphens in identifiers
From: Daniel Fischer
Date: Wed, 16 Dec 2009 17:05:42 +0100
Am Mittwoch 16 Dezember 2009 16:45:01 schrieb Ben Millwood:
> 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.

Nothing to excuse, thanks for spotting it so quickly.

>
> 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.

Yep. That comes from posting code that never saw your editor :(

>
> 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.

I'm with you.

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

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