Created
April 12, 2012 21:00
-
-
Save rahcola/2370962 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hFetchLines :: Handle -> [Int] -> IO [String] | |
hFetchLines h nums = do; end <- hIsEOF h; hFetchLines' nums end 1 [] | |
where | |
hFetchLines' [] _ _ acc = return acc | |
hFetchLines' _ False _ acc = return acc | |
hFetchLines' nums _ row acc = do | |
line <- hGetLine h | |
end <- hIsEOF h | |
if (head nums) == row | |
then hFetchLines' (tail nums) end (row+1) (line:acc) | |
else hFetchLines' nums end (row+1) acc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment