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

Martijn van Steenbergen martijn at van.steenbergen.nl
Sat Dec 20 06:34:09 EST 2008


Hi Neil,

This is awesome, thank you. :-) It found a 'use liftM', 'use on' and 
three eta-reduces in Yogurt.

It seems like the line numbers could be a bit more accurate:

./Network/Yogurt/IO.hs:54:3: Use liftM
Found:
   rec >>= return . (c :)
Why not:
   liftM (c :) rec

Where the code is:

50 -- Waits for input, but once the first character is read, waits
51 -- no longer than the specified number of ms before giving up.
52 hGetImpatientLine :: Handle -> Int -> IO String
53 hGetImpatientLine h patience = rec where
54   rec = do
55     c <- hGetChar h
56     if c == '\n'
57       then return [c]
58       else do
59         b <- hWaitForInput h patience
60         if b
61           then rec >>= return . (c:)
62           else return [c]

I imagine it could have told me to look at line 61 right away.

Thanks,

Martijn.


More information about the Haskell-Cafe mailing list