
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.

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

Hi Neil, Another question: Darcs/Commands/Optimize.lhs:110:1: Use isPrefixOf, and then remove the (==) test Found: take 4 (just_name pinfo) == "TAG " Why not: (4 == length "TAG ") && ("TAG " `isPrefixOf` just_name pinfo) I assume the (==) referred to in the name of the fix is the one in the suggestion. Why doesn't the suggestion come with the check removed? I.e.: Why not: ("TAG " `isPrefixOf` just_name pinfo) Thanks, Martijn.

Hello Martijn, Saturday, December 20, 2008, 4:38:10 PM, you wrote:
Why not: (4 == length "TAG ") && ("TAG " `isPrefixOf` just_name pinfo)
I assume the (==) referred to in the name of the fix is the one in the suggestion. Why doesn't the suggestion come with the check removed? I.e.:
due to Turing computability problem, i believe :) although Neil may try to run it in separate thread :) -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

On Sat, Dec 20, 2008 at 12:28 PM, Bulat Ziganshin
Saturday, December 20, 2008, 4:38:10 PM, you wrote:
Why not: (4 == length "TAG ") && ("TAG " `isPrefixOf` just_name pinfo)
I assume the (==) referred to in the name of the fix is the one in the suggestion. Why doesn't the suggestion come with the check removed? I.e.:
due to Turing computability problem, i believe :) although Neil may try to run it in separate thread :)
In the general case it is, but most of the time we use a constant as first argument to isPrefixOf and as such its length may be calculated in finite (and very small) time. This is a special case worth taking care of, I think. -- Felipe.
participants (4)
-
Bulat Ziganshin
-
Felipe Lessa
-
Martijn van Steenbergen
-
Niklas Broberg