1
1
mirror of https://github.com/github/semantic.git synced 2024-12-11 08:45:48 +03:00

Derive SummarizeDiff instances for the precise AST types.

This commit is contained in:
Rob Rix 2019-10-17 12:35:51 -04:00
parent 45363a7950
commit 93c459b205
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7

View File

@ -1,4 +1,4 @@
{-# LANGUAGE LambdaCase, MonoLocalBinds, TupleSections #-}
{-# LANGUAGE DerivingVia, LambdaCase, MonoLocalBinds, StandaloneDeriving, TupleSections #-}
module Semantic.Api.TOCSummaries
( diffSummary
, legacyDiffSummary
@ -30,6 +30,9 @@ import qualified Data.Text as T
import Data.These (These, fromThese)
import Diffing.Algorithm (Diffable)
import qualified Diffing.Algorithm.SES as SES
import qualified Language.Java as Java
import qualified Language.JSON as JSON
import qualified Language.Python as Python
import Parsing.Parser (SomeParser, aLaCarteParsers)
import Proto.Semantic as P hiding (Blob, BlobPair)
import Proto.Semantic_Fields as P
@ -108,6 +111,11 @@ instance (Diffable syntax, Eq1 syntax, HasDeclaration syntax, Hashable1 syntax,
decorateTerm (blob, term) = (blob, decoratorWithAlgebra (declarationAlgebra blob) term)
deriving via (ViaTags Java.Term) instance SummarizeDiff Java.Term
deriving via (ViaTags JSON.Term) instance SummarizeDiff JSON.Term
deriving via (ViaTags Python.Term) instance SummarizeDiff Python.Term
newtype ViaTags t a = ViaTags (t a)
instance Tagging.ToTags t => SummarizeDiff (ViaTags t) where