« Return to Thread: Good Haskell Style

Re: Good Haskell Style

by ChrisK-5 :: Rate this Message:

Reply to Author | View in Thread

Philippa Cowderoy wrote:

> On Wed, 1 Aug 2007, Simon Marlow wrote:
>
>> I'm rather attached to the convention I use, which is
>>
>>   - CamelCase for exported identifiers
>>   - underscores otherwise
> <snip>
>> Yes I'm aware that a single-word identifier is the same in both conventions;
>> it's not perfect.
>>
>
> How about _nonexportedIdentifier or something similar?
>

Leading underscores are used in pattern matches to indicate to GHC that unused
names like '_foo' should not cause a warning to be printed.  Otherwise the
warning is turned off by using just '_'  but that erases the readability of
using an actual name.

Thus:

take _  [] = []  -- no warning
take n  [] = []  -- warning that n is unused
take _n [] = []  -- no warning

_______________________________________________
Libraries mailing list
Libraries@...
http://www.haskell.org/mailman/listinfo/libraries

 « Return to Thread: Good Haskell Style