1
1
mirror of https://github.com/github/semantic.git synced 2025-01-02 04:10:29 +03:00

Define a Label type abstracting over Hashable1 syntax.

This commit is contained in:
Rob Rix 2018-05-16 15:59:11 -04:00
parent f362f28049
commit 367c450502

View File

@ -162,3 +162,9 @@ editDistanceUpTo m a b = diffCost m (approximateDiff a b)
Merge body -> sum (fmap ($ pred m) body)
body -> succ (sum (fmap ($ pred m) body))
approximateDiff a b = maybe (replacing a b) (merge (termAnnotation a, termAnnotation b)) (galignWith (Just . these deleting inserting approximateDiff) (termOut a) (termOut b))
data Label syntax where
Label :: syntax a -> Label syntax
instance Hashable1 syntax => Hashable (Label syntax) where hashWithSalt salt (Label syntax) = liftHashWithSalt const salt syntax