Hi Neil, Neil Mitchell <[email protected]> writes: > Yes, having darcs use HLint would be good - and I'm happy to make > changes as necessary to accommodate this. > > I'm happy to add new darcs specific hints into the main part of hlint, > and I was also going to add the ability to add new hints to HLint and > use it like a library. I'd like to generalise as many of the hints as > possible in to a way where they are useful for most people, but if > they have to be 100% darcs specific then that's fine too. Actually, I don't think we need many more rules.
> If you give me a list of examples which you want HLint to pick up on, > then I'll raise bugs for each of those, and see the best way forward. > > For example, with your readFile hint, I think what you actually want > is a banned function hint - and say Prelude.readFile is disallowed. > That's perfectly reasonable to add as a new general method. The current rule files provide everything needed to implement a reasonable check for that, apart from scoping. Unfortunately, from a quick look at hlint source, I'm not sure that's easy to solve. An example: -- this should give a warning: ---- main = readFile "foo" >>= putStr ----------------------------------- -- this should NOT give a warning: ------- import Prelude hiding( readFile ) import Data.ByteString.Char8( readFile ) main = readFile "foo" >>= putStr ------------------------------------------ I would just write the rule as: error = Prelude.readFile ==> Data.ByteString.readFile where Prelude.readFile would match readFile instances that come from Prelude but not elsewhere. The other thing is that we'd probably like hlint to return a failure code when it detects errors. Probably a "when (err > 0) $ exitWith (ExitFailure 1)" near the end of main would do the trick. Thanks, Petr. -- Petr Ročkai | http://web.mornfall.net A physicist is an atom's way of knowing about atoms. (George Wald) _______________________________________________ darcs-users mailing list [email protected] http://lists.osuosl.org/mailman/listinfo/darcs-users
