1
1
mirror of https://github.com/github/semantic.git synced 2024-12-23 06:41:45 +03:00

Simplify the selection of patches.

This commit is contained in:
Rob Rix 2017-09-10 15:15:14 +01:00
parent d678048dfd
commit e5d345dca7

View File

@ -157,7 +157,7 @@ tableOfContentsBy selector = fromMaybe [] . evalDiff diffAlgebra
(Just a, Just []) -> Just [Changed a] (Just a, Just []) -> Just [Changed a]
(_ , entries) -> entries (_ , entries) -> entries
Var v -> join (envLookup v env) Var v -> join (envLookup v env)
Patch patch -> foldMap (\ t -> maybe (fold t) (Just . pure . patchEntry patch) (selector t)) patch Patch patch -> foldMap (\ t -> fold t <> (pure . patchEntry patch <$> selector t)) patch
patchEntry = these (const Deleted) (const Inserted) (const (const Replaced)) . unPatch patchEntry = these (const Deleted) (const Inserted) (const (const Replaced)) . unPatch