From fb1198dc2f81293a0f3f415cae6abd2d6a364bbd Mon Sep 17 00:00:00 2001 From: Joshua Clayton Date: Mon, 23 May 2016 08:22:09 -0400 Subject: [PATCH] Operate on purer data sets --- src/Unused/Parser.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Unused/Parser.hs b/src/Unused/Parser.hs index 18d8097..9db4a05 100644 --- a/src/Unused/Parser.hs +++ b/src/Unused/Parser.hs @@ -6,14 +6,14 @@ module Unused.Parser import Data.Bifunctor (second) import qualified Data.Map.Strict as Map import Unused.Util (groupBy) -import Unused.Types (ParseResponse, TermMatch, resultsFromMatches, tmTerm) +import Unused.Types (ParseResponse, TermMatchSet, TermMatch, resultsFromMatches, tmTerm) import Unused.LikelihoodCalculator import Unused.Parser.Internal parseLines :: [LanguageConfiguration] -> String -> ParseResponse parseLines lcs = - responseFromParse lcs . parse parseTermMatches "matches" + fmap (matchesToMatchSet lcs) . parse parseTermMatches "matches" -responseFromParse :: [LanguageConfiguration] -> Either ParseError [TermMatch] -> ParseResponse -responseFromParse lcs = - fmap $ Map.fromList . map (second $ calculateLikelihood lcs . resultsFromMatches) . groupBy tmTerm +matchesToMatchSet :: [LanguageConfiguration] -> [TermMatch] -> TermMatchSet +matchesToMatchSet lcs = + Map.fromList . map (second $ calculateLikelihood lcs . resultsFromMatches) . groupBy tmTerm