[Haskell-cafe] Re: [Haskell] ANN: HLint 1.0

Hugo Pacheco hpacheco at gmail.com
Sat Dec 20 10:30:45 EST 2008


On Sat, Dec 20, 2008 at 3:06 PM, Neil Mitchell <ndmitchell at gmail.com> wrote:

> Hi
>
> > I noticed that you convert point-wise into point-free.
> > Perhaps you could add some point-free transformations to remove
> redundancy
> > in certain cases.
> > Is that a goal of the library?
>
> It does some transformations of th at nature, but the idea isn't to
> remove redundancy, its to make the code clearer. Do you have any
> suggestions for things it could easily do to remove redundancy?


There are many simple ones, such as:
f . id -> f
filter true -> id
map id -> id
... etc


> It
> already does a few relating to if expressions.
>

Yes, like map f . map g -> map (f . g)

You can find more in Transformation of Structure-Shy Programs - Applied to
XPath Queries and Strategic
Functions,<http://www.di.uminho.pt/~mac/Publications/pepm07corrected.pdf>
page
4.

>
> > a suggestion for a rule: dollar eta: f $ x -> f x
>
> That can easily be added.
>
> > Why not:
> > ("TAG " `isPrefixOf` just_name pinfo)
>
> That's an open bug:
> http://code.google.com/p/ndmitchell/issues/detail?id=109
>
> In general, most of the hints are "replace this with this" -
> evaluating the new bit (even to remove easy constants) is beyond it
> for the moment. Some people theorised it might be too hard,
> non-terminating, or incorrect. As it happens this rule only fires when
> "TAG " is either a string literal or a list literal, and when the
> number is a constant, so its always safe and the guard could always be
> eliminated.
>
> > 1) How does one actually use the CLI tool? You didn't say. It *seems*
> > that one just feeds it a list of random filepaths, so on Mueval, say,
> > the command would be 'hlint main.hs Mueval/*.hs' (and not, say, 'hlint
> > mueval.cabal'). But I'm not actually sure.
>
> The filenames are either filenames, or directories which are
> recursively searched, i.e cd mueval && hlint . is probably sufficient.
> I should document it more clearly in the manual.
>
> Thanks
>
> Neil
>



-- 
www.di.uminho.pt/~hpacheco
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20081220/6c8749c5/attachment.htm


More information about the Haskell-Cafe mailing list