Good Haskell Style
haskell at list.mightyreason.com
Wed Aug 1 11:30:34 EDT 2007
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
>> 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.
take _  =  -- no warning
take n  =  -- warning that n is unused
take _n  =  -- no warning
More information about the Libraries