[Haskell-cafe] ANN: pandoc 1.0.0.1

John Goerzen jgoerzen at complete.org
Sun Sep 14 00:37:43 EDT 2008


On Sat, Sep 13, 2008 at 09:31:50PM -0500, brian wrote:
> On Sat, Sep 13, 2008 at 8:29 PM, John MacFarlane <jgm at berkeley.edu> wrote:
> > + Code is -Wall clean
> 
> Thanks, I appreciate it. I wish more people paid attention to this.

Well.  I often pay attention to it.  That doesn't mean I always heed
it ;-)

Like all -Wall stuff, sometimes warnings are great and sometimes
warnings are noise.

There are two warnings that I am prone to ignore:

1) No type definition for top-level declarations

Whether or not I ignore this depends on what sort of code I'm working
on.  If I'm using Haskell as, essentially, a script language, or
writing a quick and small Parsec parser, adding a bunch of type
declarations can serve to make the code less readable and certainly
more difficult to update and maintain.  That said, for larger projects
or computation algorithms, I'd usually add declarations.

When I'm leaving off the declarations, my code sometimes winds up
looking like something vaguely resembling Python.  Sometimes time
declarations just get in the way.  Cue type inference.  One of my
favorite things about Haskell: it can be as compact as Python (or
moreso), yet detect type errors at compile time.

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.

Some of my libraries, on the other hand, are periodically validated
against -Wall -Werror.

-- John


More information about the Haskell-Cafe mailing list