wiki:Underscore

Version 1 (modified by john@…, 8 years ago) (diff)

--

Treatment of names beginning with underscore

It is a convention that the compiler will not warn about unused variables that begin with an underscore. An underscore also counts as a lower case letter meaning that you cannot start type, class, or data constructors with it.

proposal

Make underscore 'caseless' meaning when deciding whether a name is a constructor or not, look through underscores. so

data Foo = Foo | _Bar  -- ^ _Bar possibly unused

will be valid.

we can either treat identifiers containing only underscores as lowercase names or invalid depending on how important the ability to obfscusiate code is to us.

The leading underscore convention is not only useful as a way to suppress warnings, but as a form of documentation that we expect a name to be unused so being able to use it in these cases would be helpful.