[Haskell-cafe] ANN: pandoc 1.0.0.1
Max Bolingbroke
batterseapower at hotmail.com
Sun Sep 14 07:07:30 EDT 2008
2008/9/14 John Goerzen <jgoerzen at complete.org>:
> 2) Variable x defined but not used
>
> I most often ignore this when it occurs in a function definition.
> Sometimes I may have a function that could be written
>
> foo _ (x, _) _ = bar (x + 5)
>
> But for clarity's sake on what all the unused args are, which really
> helps for future maintainability, I'll usually use a descriptive --
> but unused -- variable name.
This doesn't appear to be commonly known, but actually any identifier
that /starts/ with an _ will not trigger the unused-arg warning. So if
you wrote your example like this:
foo _stuff (x, _y) _more = bar (x + 5)
It would satisfy both the compiler and your desire for descriptive
variable names.
Cheers,
Max
More information about the Haskell-Cafe
mailing list