[Haskell-cafe] Re: [Haskell] ANN: HLint 1.0
Niklas Broberg
niklas.broberg at gmail.com
Sat Dec 20 07:42:13 EST 2008
> 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.
You can blame HSE in this case, it only stores line numbers for
certain constructs, and expressions are not among them. The closest
predictable construct for this case is the RHS of the function
definition, which is why you get line 54. This is something I hope to
improve in HSE over time.
Cheers,
/Niklas
More information about the Haskell-Cafe
mailing list