On Thu, Aug 6, 2009 at 2:04 AM, Petr Rockai<[email protected]> wrote:
Gwern Branwen <[email protected]> writes:What's the status on this? It has been released now, yes?Yes, but we still need to do the work of actually replacing haskell_policy -- so far no-one had the time to do that. If you volunteer, that'd be great, as I'm buried with other stuff currently. :) Yours, Petr.
I've been working on it - easy enough to disable eta reductions, but there's an odd issue with the imported functions such as readFile: [03:35 AM] 0Mb$ cat foo foo.hs && echo ignore "Eta reduce" = "" error = Prelude.readFile ==> Data_ByteString_readFile main = Prelude.readFile "foo" >> return ()[03:36 AM] 0Mb$ hlint --hint=foo foo.hs foo.hs:1:1: Error: Use Data_ByteString_readFile
Found: Prelude.readFile Why not: Data_ByteString_readFile Found 1 suggestion (1 error) [03:35 AM] 0Mb$ nano foo && cat foo foo.hs && echo ignore "Eta reduce" = "" error = Prelude.readFile ==> Data.ByteString.readFile main = Prelude.readFile "foo" >> return ()[03:36 AM] 0Mb$ hlint --hint=foo foo.hs hlint: Prelude.head: empty list
If I specify
error = Prelude.readFile ==> Data.ByteString.readFile
I crash darcs hlint with head. If the periods are replaced with, say,
underscores, I get the correct suggestion.
Also, I am mildly mystified as to why the rule works for readFile, but not
hGetContents:
[03:42 AM] 0Mb$ cat foo.hs
import System.IO
main = do Prelude.readFile "foo"
x <- hGetContents
return ()
[03:42 AM] 0Mb$ cat foo
ignore "Eta reduce" = ""
warning = Prelude.readFile ==> Data_ByteString_readFile
warning = System.IO.hGetContents ==> Data_ByteString_hGetContents
[03:42 AM] 0Mb$ hlint --hint=foo foo.hs
foo.hs:3:1: Warning: Use Data_ByteString_readFile
Found: Prelude.readFile Why not: Data_ByteString_readFile Found 1 suggestion (There should be 2 suggestions.) Finally, there's no way apparently to warn about whitespace, which is the third and last thing haskell_policy does (it warns about readFile, hGetContents, and tabs). This we may simply have to forget about. -- gwern
signature.asc
Description: OpenPGP digital signature
_______________________________________________ darcs-users mailing list [email protected] http://lists.osuosl.org/mailman/listinfo/darcs-users
