diff --git a/src/Semantic.hs b/src/Semantic.hs index 4b8004dd5..f24d51e1c 100644 --- a/src/Semantic.hs +++ b/src/Semantic.hs @@ -30,7 +30,7 @@ import Term -- - 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, HasField fields Category, NFData (Record fields)) => (Source -> Term (Syntax Text) (Record DefaultFields) -> Term (Syntax Text) (Record fields)) -> Renderer (Both SourceBlob, Diff (Syntax Text) (Record fields)) output -> [Both SourceBlob] -> IO ByteString +diffBlobPairs :: (Monoid output, StringConv output ByteString, HasField fields Category) => (Source -> Term (Syntax Text) (Record DefaultFields) -> Term (Syntax Text) (Record fields)) -> Renderer (Both SourceBlob, Diff (Syntax Text) (Record fields)) output -> [Both SourceBlob] -> IO ByteString diffBlobPairs decorator renderer blobs = renderConcurrently parseDiffAndRender blobs where parseDiffAndRender blobPair = do @@ -40,7 +40,7 @@ diffBlobPairs decorator renderer blobs = renderConcurrently parseDiffAndRender b Nothing -> mempty -- | Diff a pair of SourceBlobs. -diffBlobPair :: (HasField fields Category, NFData (Record fields)) => (Source -> Term (Syntax Text) (Record DefaultFields) -> Term (Syntax Text) (Record fields)) -> Both SourceBlob -> IO (Maybe (Diff (Syntax Text) (Record fields))) +diffBlobPair :: HasField fields Category => (Source -> Term (Syntax Text) (Record DefaultFields) -> Term (Syntax Text) (Record fields)) -> Both SourceBlob -> IO (Maybe (Diff (Syntax Text) (Record fields))) diffBlobPair decorator blobs = do terms <- Async.mapConcurrently (parseBlob decorator) blobs pure $ case (runJoin blobs, runJoin terms) of @@ -52,7 +52,7 @@ diffBlobPair decorator blobs = do runDiff terms = runBothWith diffTerms terms -- | Parse a list of SourceBlobs and use the specified renderer to produce ByteString output. -parseBlobs :: (Monoid output, StringConv output ByteString, NFData (Record fields)) => (Source -> Term (Syntax Text) (Record DefaultFields) -> Term (Syntax Text) (Record fields)) -> Renderer (Identity SourceBlob, Term (Syntax Text) (Record fields)) output -> [SourceBlob] -> IO ByteString +parseBlobs :: (Monoid output, StringConv output ByteString) => (Source -> Term (Syntax Text) (Record DefaultFields) -> Term (Syntax Text) (Record fields)) -> Renderer (Identity SourceBlob, Term (Syntax Text) (Record fields)) output -> [SourceBlob] -> IO ByteString parseBlobs decorator renderer blobs = renderConcurrently parseAndRender (filter (not . nonExistentBlob) blobs) where parseAndRender blob = do @@ -60,7 +60,7 @@ parseBlobs decorator renderer blobs = renderConcurrently parseAndRender (filter pure $! runRenderer renderer (Identity blob, term) -- | Parse a SourceBlob. -parseBlob :: NFData (Record fields) => (Source -> Term (Syntax Text) (Record DefaultFields) -> Term (Syntax Text) (Record fields)) -> SourceBlob -> IO (Term (Syntax Text) (Record fields)) +parseBlob :: (Source -> Term (Syntax Text) (Record DefaultFields) -> Term (Syntax Text) (Record fields)) -> SourceBlob -> IO (Term (Syntax Text) (Record fields)) parseBlob decorator SourceBlob{..} = decorator source <$> runParser (parserForLanguage blobLanguage) source