From 88f69156e74d43e19930967b7d326a880092aef0 Mon Sep 17 00:00:00 2001 From: Filip Gralinski Date: Tue, 13 Feb 2018 08:44:27 +0100 Subject: [PATCH] refactor code --- src/GEval/LineByLine.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/GEval/LineByLine.hs b/src/GEval/LineByLine.hs index 2461063..750f11f 100644 --- a/src/GEval/LineByLine.hs +++ b/src/GEval/LineByLine.hs @@ -49,9 +49,13 @@ runLineByLine spec = do gevalLineByLineCore :: Metric -> FilePath -> FilePath -> FilePath -> Sink LineRecord (ResourceT IO) () -> IO () gevalLineByLineCore metric inputFilePath expectedFilePath outFilePath consum = runResourceT $ - ((getZipSource $ (,) + ((gevalLineByLineSource metric inputFilePath expectedFilePath outFilePath) $$ consum) + +gevalLineByLineSource :: Metric -> FilePath -> FilePath -> FilePath -> Source (ResourceT IO) LineRecord +gevalLineByLineSource metric inputFilePath expectedFilePath outFilePath = + (getZipSource $ (,) <$> ZipSource (CL.sourceList [1..]) - <*> (ZipSource $ recordSource context parserSpec)) =$= CL.mapM (checkStepM evaluateLine) =$= CL.catMaybes $$ consum) + <*> (ZipSource $ recordSource context parserSpec)) =$= CL.mapM (checkStepM evaluateLine) =$= CL.catMaybes where parserSpec = (ParserSpecWithInput (Right . id) (Right . id) (Right . id)) context = (WithInput inputLineSource expectedLineSource outputLineSource) inputLineSource = fileAsLineSource inputFilePath