diff options
Diffstat (limited to 'Log.hs')
-rw-r--r-- | Log.hs | 11 |
1 files changed, 4 insertions, 7 deletions
@@ -87,10 +87,7 @@ parseLog = map eitherDecode' . filter (not . L.null) . L.split (fromIntegral (ord '\n')) --- | Throws exception on unparsable log. -loadLog :: FilePath -> IO [Log] -loadLog f = do - parsed <- parseLog <$> L.readFile f - case lefts parsed of - [] -> return (rights parsed) - errs -> error $ unlines errs +-- | Streams a log without loading it all into memory. +-- When lines cannot be parsed, they will be Left. +streamLog :: FilePath -> IO [Either String Log] +streamLog f = parseLog <$> L.readFile f |