Skip to content

Instantly share code, notes, and snippets.

@rahcola rahcola/gist:2370962
Created Apr 12, 2012

Embed
What would you like to do?
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
You can’t perform that action at this time.