1
1
mirror of https://github.com/github/semantic.git synced 2024-12-21 13:51:44 +03:00

Merge branch 'strictness' into profiling-improvements

This commit is contained in:
Rob Rix 2015-12-23 19:43:27 -05:00
commit ffa4462aab
2 changed files with 3 additions and 3 deletions

View File

@ -4,15 +4,15 @@ import Diff
import Range
import Parser
import Syntax
import Term
import TreeSitter
import Control.Comonad.Cofree
import Data.Foldable
parserForType :: String -> Parser
parserForType mediaType = maybe lineByLineParser parseTreeSitterFile $ languageForType mediaType
lineByLineParser :: Parser
lineByLineParser input = return . root . Indexed $ case foldl annotateLeaves ([], 0) lines of
lineByLineParser input = return . root . Indexed $ case foldl' annotateLeaves ([], 0) lines of
(leaves, _) -> leaves
where
lines = Prelude.lines input

View File

@ -33,7 +33,7 @@ unified diff before after = do
unifiedRange :: Range -> [([Chunk String], Maybe Range)] -> String -> [Chunk String]
unifiedRange range children source = out <> (pure . chunk $ substring Range { start = previous, end = end range } source) where
(out, previous) = foldl accumulateContext ([], start range) children
(out, previous) = foldl' accumulateContext ([], start range) children
accumulateContext (out, previous) (child, Just range) = (mconcat [ out, pure . chunk $ substring Range { start = previous, end = start range } source, child ], end range)
accumulateContext (out, previous) (child, _) = (out <> child, previous)