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

Define a DiffTerms instance for TSX.

This commit is contained in:
Rob Rix 2019-10-18 16:28:37 -04:00
parent 8a9a209c01
commit 15615fc4de
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7

View File

@ -1,4 +1,4 @@
{-# LANGUAGE DataKinds, GeneralizedNewtypeDeriving #-}
{-# LANGUAGE DataKinds, GeneralizedNewtypeDeriving, TypeFamilies #-}
module Language.TSX.Term
( Syntax
, Term(..)
@ -17,6 +17,7 @@ import qualified Data.Syntax.Statement as Statement
import qualified Data.Syntax.Type as Type
import qualified Data.Diff as Diff
import qualified Data.Term as Term
import Diffing.Interpreter
import qualified Language.TSX.Syntax as TSX.Syntax
type Syntax =
@ -195,3 +196,7 @@ newtype Term ann = Term { getTerm :: Term.Term (Sum Syntax) ann }
newtype Diff ann1 ann2 = Diff { getDiff :: Diff.Diff (Sum Syntax) ann1 ann2 }
deriving (Bifoldable, Bifunctor)
instance DiffTerms Term where
type DiffFor Term = Diff
diffTermPair = Diff . diffTermPair . bimap getTerm getTerm