- (o, _, []) -> ioError $ userError $ "must supply input file"
- (_, _, errs) -> ioError $ userError $ (concat errs)
+ (o, _, []) -> ioError $ userError $ "missing input file"
+ (_, _, errs) -> ioError $ userError $ concat errs
+
+-- reads in file by lines
+hGetLines :: Handle -> IO [String]
+hGetLines h = do
+ line <- hGetLine h
+ isEof <- hIsEOF h
+ if isEof then return [line]
+ else do
+ lines <- hGetLines h
+ return (line:lines)