ANN: scan-0.1.0.3, a Haskell style scanner

Dear Haskell friends, I like to announce a Haskell style scanner at http://hackage.haskell.org/package/scan documented under http://projects.haskell.org/style-scanner/ It's best used in conjunction with hlint http://community.haskell.org/~ndm/hlint/ and gives many suggestions regarding the file format. Feedback is welcome. Thanks Christian (Discussions should only be posted to either haskell-cafe@ or beginners@)

Hello Christian, On Apr 19, 2010, at 4:48 PM, Christian Maeder wrote:
I like to announce a Haskell style scanner at http://hackage.haskell.org/package/scan
Feedback is welcome.
I get lots of "multiple blanks" which I'd rather not "correct". I often use multiple blanks to achieve vertical layout which is especially useful in combination with lhs2TeX [1] whose polycode mode requires multiple blanks to achieve proper indentation. This code instance Eq a => Eq (Maybe a) where Nothing == Nothing = True Just x == Just y = x == y _ == _ = False triggers this scan output: scan-test.hs:2:10: up to column 12 multiple (2) blanks scan-test.hs:2:14: up to column 16 multiple (2) blanks scan-test.hs:2:23: up to column 25 multiple (2) blanks scan-test.hs:3:9: up to column 12 multiple (3) blanks scan-test.hs:3:14: up to column 16 multiple (2) blanks scan-test.hs:3:22: up to column 25 multiple (3) blanks scan-test.hs:4:4: up to column 12 multiple (8) blanks scan-test.hs:4:14: up to column 16 multiple (2) blanks scan-test.hs:4:17: up to column 25 multiple (8) blanks I very much prefer the previous indentation over the following version stripped down by scan - (using the hyphen option): instance Eq a => Eq (Maybe a) where Nothing == Nothing = True Just x == Just y = x == y _ == _ = False I did not find a way to configure scan to ignore "multiple blanks". Did I miss it? Sebastian [1]: http://people.cs.uu.nl/andres/lhs2tex/ -- Underestimating the novelty of the future is a time-honored tradition. (D.G.)

Sebastian Fischer schrieb:
Hello Christian,
On Apr 19, 2010, at 4:48 PM, Christian Maeder wrote:
I like to announce a Haskell style scanner at http://hackage.haskell.org/package/scan
Feedback is welcome.
I get lots of "multiple blanks" which I'd rather not "correct".
I often use multiple blanks to achieve vertical layout which is especially useful in combination with lhs2TeX [1] whose polycode mode requires multiple blanks to achieve proper indentation.
This code
instance Eq a => Eq (Maybe a) where Nothing == Nothing = True Just x == Just y = x == y _ == _ = False
This sort of tabular layout is not supported by scan.
triggers this scan output:
scan-test.hs:2:10: up to column 12 multiple (2) blanks scan-test.hs:2:14: up to column 16 multiple (2) blanks scan-test.hs:2:23: up to column 25 multiple (2) blanks scan-test.hs:3:9: up to column 12 multiple (3) blanks scan-test.hs:3:14: up to column 16 multiple (2) blanks scan-test.hs:3:22: up to column 25 multiple (3) blanks scan-test.hs:4:4: up to column 12 multiple (8) blanks scan-test.hs:4:14: up to column 16 multiple (2) blanks scan-test.hs:4:17: up to column 25 multiple (8) blanks
At least you see a regular pattern wrt column position: (12, 16, 25)
I very much prefer the previous indentation over the following version stripped down by scan - (using the hyphen option):
instance Eq a => Eq (Maybe a) where Nothing == Nothing = True Just x == Just y = x == y _ == _ = False
I did not find a way to configure scan to ignore "multiple blanks". Did I miss it?
It isn't yet implemented. Cheers Christian
Sebastian

I wrote:
I did not find a way to configure scan to ignore "multiple blanks".
The poor man's solution is to pipe the output through grep --invert-match --regexp="multiple ([0-9]*) blanks" I agree with Henning about the hyphen option. This often (usually?) means "don't read from a file but from stdin". Sebastian -- Underestimating the novelty of the future is a time-honored tradition. (D.G.)

On Mon, 19 Apr 2010, Christian Maeder wrote:
Dear Haskell friends,
I like to announce a Haskell style scanner at http://hackage.haskell.org/package/scan
At first I thought it is a scanner (for whatever purpose) implemented in Haskell style. No it checks whether a Haskell module follows a certain style. - Nice idea and nice implementation!
documented under http://projects.haskell.org/style-scanner/
The updated Haskell code might be written to a new file by default. Then I can interactively transfer the corrections I like to the original code using Kompare. I would also not use '-' as option. How would you extend the set of options later, say for de-/selection of specific warnings?

Henning Thielemann schrieb:
On Mon, 19 Apr 2010, Christian Maeder wrote:
Dear Haskell friends,
I like to announce a Haskell style scanner at http://hackage.haskell.org/package/scan
At first I thought it is a scanner (for whatever purpose) implemented in Haskell style. No it checks whether a Haskell module follows a certain style. - Nice idea and nice implementation!
documented under http://projects.haskell.org/style-scanner/
The updated Haskell code might be written to a new file by default. Then I can interactively transfer the corrections I like to the original code using Kompare. I would also not use '-' as option. How would you extend the set of options later, say for de-/selection of specific warnings?
I don't know (and have) "Kompare", thanks for mentioning it. Currently '-' is the only option and I expect other options to be different from it, like "-l" or "-i". (But maybe I'll change it or add a "-o" option.) Christian

Christian Maeder schrieb:
Henning Thielemann schrieb:
The updated Haskell code might be written to a new file by default. Then I can interactively transfer the corrections I like to the original code using Kompare. I would also not use '-' as option. How would you extend the set of options later, say for de-/selection of specific warnings?
I don't know (and have) "Kompare", thanks for mentioning it.
It's part of KDE. There is also TkDiff, but I don't know whether it supports moving around changes.

=On Mon, Apr 19, 2010 at 06:24:25PM +0200, Henning Thielemann wrote:
Christian Maeder schrieb:
Henning Thielemann schrieb:
The updated Haskell code might be written to a new file by default. Then I can interactively transfer the corrections I like to the original code using Kompare. I would also not use '-' as option. How would you extend the set of options later, say for de-/selection of specific warnings?
I don't know (and have) "Kompare", thanks for mentioning it.
It's part of KDE. There is also TkDiff, but I don't know whether it supports moving around changes.
Gnome users may like using Meld as much as I do. http://meld.sourceforge.net/ -- Felipe.

I think, I've addressed the points made by Henning and Sebastian. (Don't forget to "cabal update".) Cheers Christian
Dear Haskell friends,
I like to announce a Haskell style scanner at http://hackage.haskell.org/package/scan
documented under http://projects.haskell.org/style-scanner/
It's best used in conjunction with hlint http://community.haskell.org/~ndm/hlint/
and gives many suggestions regarding the file format.
Feedback is welcome.
Thanks Christian
(Discussions should only be posted to either haskell-cafe@ or beginners@)

Dear Haskell friends, I like to announce a new version of the style scanner for Haskell source files at http://hackage.haskell.org/package/scan documented under http://projects.haskell.org/style-scanner/ cabal update cabal install scan A short description is also here: http://haskell.org/communities/05-2010/html/report.html#sect4.2.4 It has now many more options (one is better windows support using -w), diagnostics, and change capabilities regarding (haddock) comments. Feedback is welcome. Thanks Christian
participants (5)
-
Christian Maeder
-
Felipe Lessa
-
Henning Thielemann
-
Henning Thielemann
-
Sebastian Fischer