1
1
mirror of https://github.com/github/semantic.git synced 2025-01-04 13:34:31 +03:00

Define a Recursive instance for TSX.Term.

This commit is contained in:
Rob Rix 2019-10-18 16:39:01 -04:00
parent 78e332d5ba
commit 9cb6c69a1b
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7

View File

@ -8,6 +8,7 @@ module Language.TSX.Term
import Data.Abstract.Declarations
import Data.Bifoldable
import Data.Bifunctor
import Data.Functor.Foldable
import Data.Sum (Sum)
import qualified Data.Syntax as Syntax
import qualified Data.Syntax.Comment as Comment
@ -201,3 +202,8 @@ newtype Diff ann1 ann2 = Diff { getDiff :: Diff.Diff (Sum Syntax) ann1 ann2 }
instance DiffTerms Term where
type DiffFor Term = Diff
diffTermPair = Diff . diffTermPair . bimap getTerm getTerm
type instance Base (Term ann) = Term.TermF (Sum Syntax) ann
instance Recursive (Term ann) where
project = fmap Term . project . getTerm