From bba39a552486e2fb329bd93adfeb31a75720d13f Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 10 May 2017 15:21:35 -0400 Subject: [PATCH] diffBlobPairs takes a decorator to apply. --- src/Semantic.hs | 6 +++--- src/SemanticCmdLine.hs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Semantic.hs b/src/Semantic.hs index 5144e7b9c..c937ef35b 100644 --- a/src/Semantic.hs +++ b/src/Semantic.hs @@ -46,14 +46,14 @@ import System.FilePath -- - Easy to consume this interface from other application (e.g a cmdline or web server app). -- | Diff a list of SourceBlob pairs to produce ByteString output using the specified renderer. -diffBlobPairs :: (Monoid output, StringConv output ByteString) => DiffRenderer DefaultFields output -> [Both SourceBlob] -> IO ByteString -diffBlobPairs renderer blobs = do +diffBlobPairs :: (Monoid output, StringConv output ByteString, HasField fields Category, NFData (Record fields)) => (Source -> Term (Syntax Text) (Record DefaultFields) -> Term (Syntax Text) (Record fields)) -> DiffRenderer fields output -> [Both SourceBlob] -> IO ByteString +diffBlobPairs decorator renderer blobs = do diffs <- Async.mapConcurrently go blobs let diffs' = diffs >>= \ (blobs, diff) -> (,) blobs <$> toList diff toS <$> renderConcurrently (resolveDiffRenderer renderer) (diffs' `using` parTraversable (parTuple2 r0 rdeepseq)) where go blobPair = do - diff <- diffBlobPair identity blobPair + diff <- diffBlobPair decorator blobPair pure (blobPair, diff) -- | Diff a pair of SourceBlobs. diff --git a/src/SemanticCmdLine.hs b/src/SemanticCmdLine.hs index d88392ccf..c03549703 100644 --- a/src/SemanticCmdLine.hs +++ b/src/SemanticCmdLine.hs @@ -49,7 +49,7 @@ runDiff DiffArguments{..} = do blobs <- runCommand $ case diffMode of DiffPaths a b -> pure <$> traverse readFile (both a b) DiffCommits sha1 sha2 paths -> readFilesAtSHAs gitDir alternateObjectDirs paths (both sha1 sha2) - Semantic.diffBlobPairs diffRenderer blobs + Semantic.diffBlobPairs identity diffRenderer blobs runParse :: ParseArguments -> IO ByteString runParse ParseArguments{..} = do