1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 22:31:36 +03:00

🔥 redundant NFData constraints.

This commit is contained in:
Rob Rix 2017-05-26 15:29:50 -04:00
parent c98efce511
commit 6b23b5cf3f

View File

@ -30,7 +30,7 @@ import Term
-- - Easy to consume this interface from other application (e.g a cmdline or web server app). -- - 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. -- | 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 diffBlobPairs decorator renderer blobs = renderConcurrently parseDiffAndRender blobs
where where
parseDiffAndRender blobPair = do parseDiffAndRender blobPair = do
@ -40,7 +40,7 @@ diffBlobPairs decorator renderer blobs = renderConcurrently parseDiffAndRender b
Nothing -> mempty Nothing -> mempty
-- | Diff a pair of SourceBlobs. -- | 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 diffBlobPair decorator blobs = do
terms <- Async.mapConcurrently (parseBlob decorator) blobs terms <- Async.mapConcurrently (parseBlob decorator) blobs
pure $ case (runJoin blobs, runJoin terms) of pure $ case (runJoin blobs, runJoin terms) of
@ -52,7 +52,7 @@ diffBlobPair decorator blobs = do
runDiff terms = runBothWith diffTerms terms runDiff terms = runBothWith diffTerms terms
-- | Parse a list of SourceBlobs and use the specified renderer to produce ByteString output. -- | 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) parseBlobs decorator renderer blobs = renderConcurrently parseAndRender (filter (not . nonExistentBlob) blobs)
where where
parseAndRender blob = do parseAndRender blob = do
@ -60,7 +60,7 @@ parseBlobs decorator renderer blobs = renderConcurrently parseAndRender (filter
pure $! runRenderer renderer (Identity blob, term) pure $! runRenderer renderer (Identity blob, term)
-- | Parse a SourceBlob. -- | 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 parseBlob decorator SourceBlob{..} = decorator source <$> runParser (parserForLanguage blobLanguage) source