Merge branch 'fix-haddock' of git.applica.pl:piotr.halama/geval

This commit is contained in:
Filip Gralinski 2018-12-14 07:28:27 +01:00
commit d671989a09

View File

@ -751,18 +751,18 @@ skipLineNumber :: (x -> c) -> ((Word32, x) -> c)
skipLineNumber fun = fun . snd skipLineNumber fun = fun . snd
-- | A helper function to run evaluation when the input is not needed to calculate the metric value. -- | A helper function to run evaluation when the input is not needed to calculate the metric value.
gevalCoreWithoutInput :: (MonadUnliftIO m, MonadThrow m, MonadIO m) => gevalCoreWithoutInput :: (MonadUnliftIO m, MonadThrow m, MonadIO m)
(Text -> Either String a) -> -- ^ parser for values in the expected output => (Text -> Either String a) -- ^ parser for values in the expected output
(Text -> Either String b) -> -- ^ parser for values in the actual output -> (Text -> Either String b) -- ^ parser for values in the actual output
((a, b) -> c) -> -- ^ function which combines parsed values into a single value -> ((a, b) -> c) -- ^ function which combines parsed values into a single value
-- (will be launched for each item, e.g. an error/cost function -- (will be launched for each item, e.g. an error/cost function
-- could be calculated here) -- could be calculated here)
(ConduitT c Void (ResourceT m) d) -> -- ^ a Conduit which aggregates all the combined values into -> (ConduitT c Void (ResourceT m) d) -- ^ a Conduit which aggregates all the combined values into
-- a "total" value -- a "total" value
(d -> Double) -> -- ^ function to transform the "total" value into the final score -> (d -> Double) -- ^ function to transform the "total" value into the final score
LineSource (ResourceT m) -> -- ^ source to read the expected output -> LineSource (ResourceT m) -- ^ source to read the expected output
LineSource (ResourceT m) -> -- ^ source to read the output -> LineSource (ResourceT m) -- ^ source to read the output
m (MetricValue) -- ^ metric values for the output against the expected output -> m (MetricValue) -- ^ metric values for the output against the expected output
gevalCoreWithoutInput expParser outParser itemStep aggregator finalStep expectedLineStream outLineStream = gevalCoreWithoutInput expParser outParser itemStep aggregator finalStep expectedLineStream outLineStream =
gevalCoreGeneralized (ParserSpecWithoutInput expParser outParser) (trans itemStep) aggregator finalStep (WithoutInput expectedLineStream outLineStream) gevalCoreGeneralized (ParserSpecWithoutInput expParser outParser) (trans itemStep) aggregator finalStep (WithoutInput expectedLineStream outLineStream)
where where
@ -780,14 +780,14 @@ gevalCore''' parserSpec itemStep aggregator finalStep context =
-- was used. It could be seen as the "engine" to run the evaluation. -- was used. It could be seen as the "engine" to run the evaluation.
-- If you are defining a new metric, you usually don't have to change anything -- If you are defining a new metric, you usually don't have to change anything
-- here. -- here.
gevalCoreGeneralized :: (EvaluationContext ctxt m, MonadUnliftIO m, MonadThrow m, MonadIO m) => gevalCoreGeneralized :: (EvaluationContext ctxt m, MonadUnliftIO m, MonadThrow m, MonadIO m)
ParserSpec ctxt -> -- ^ parsers to parse data => ParserSpec ctxt -- ^ parsers to parse data
(ParsedRecord ctxt -> c) -> -- ^ function to go from the parsed value into -> (ParsedRecord ctxt -> c) -- ^ function to go from the parsed value into
-- some "local" score calculated for each line (item) -- some "local" score calculated for each line (item)
(ConduitT c Void (ResourceT m) d) -> -- ^ a Conduit to aggregate score into a "total" -> (ConduitT c Void (ResourceT m) d) -- ^ a Conduit to aggregate score into a "total"
(d -> Double) -> -- ^ function to transform the "total" value into the final score -> (d -> Double) -- ^ function to transform the "total" value into the final score
ctxt -> -- ^ "context", i.e. 2 or 3 sources needed to operate -> ctxt -- ^ "context", i.e. 2 or 3 sources needed to operate
m (MetricValue) -> m (MetricValue)
gevalCoreGeneralized parserSpec itemStep aggregator finalStep context = gevalCoreGeneralized parserSpec itemStep aggregator finalStep context =
gevalCoreGeneralized' parserSpec (skipLineNumber itemStep) aggregator finalStep context gevalCoreGeneralized' parserSpec (skipLineNumber itemStep) aggregator finalStep context