mirror of
https://github.com/github/semantic.git
synced 2024-11-28 01:47:01 +03:00
Define a function computing the equivalence of terms based on subequivalence.
This commit is contained in:
parent
98ac25fe84
commit
82244515f8
@ -106,6 +106,14 @@ algorithmForTerms t1@(Term (In ann1 f1)) t2@(Term (In ann2 f2))
|
||||
<|> insertF . In ann2 <$> subalgorithmFor byInserting ( mergeFor t1) f2
|
||||
where mergeFor (Term (In ann1 f1)) (Term (In ann2 f2)) = merge (ann1, ann2) <$> algorithmFor f1 f2
|
||||
|
||||
equivalentTerms :: Diffable syntax
|
||||
=> Term syntax ann1
|
||||
-> Term syntax ann2
|
||||
-> Bool
|
||||
equivalentTerms term1@(Term (In _ syntax1)) term2@(Term (In _ syntax2))
|
||||
= subequivalenceTo (flip equivalentTerms term2) syntax1
|
||||
|| subequivalenceTo ( equivalentTerms term1) syntax2
|
||||
|
||||
-- | A type class for determining what algorithm to use for diffing two terms.
|
||||
class Diffable f where
|
||||
-- | Construct an algorithm to diff a pair of @f@s populated with disjoint terms.
|
||||
|
@ -6,7 +6,7 @@ module Interpreter
|
||||
, equivalentTerms
|
||||
) where
|
||||
|
||||
import Algorithm
|
||||
import Algorithm hiding (equivalentTerms)
|
||||
import Control.Applicative (Alternative(..))
|
||||
import Control.Monad.Free.Freer
|
||||
import Data.Align.Generic
|
||||
|
Loading…
Reference in New Issue
Block a user