summaryrefslogtreecommitdiffhomepage
path: root/Log.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Log.hs')
-rw-r--r--Log.hs11
1 files changed, 4 insertions, 7 deletions
diff --git a/Log.hs b/Log.hs
index 50c506d..6c45074 100644
--- a/Log.hs
+++ b/Log.hs
@@ -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