1
1
mirror of https://github.com/github/semantic.git synced 2024-12-24 15:35:14 +03:00

Add a function to extract the annotation from a SplitDiff.

This commit is contained in:
Rob Rix 2016-03-04 09:16:07 -05:00
parent ea143b6633
commit 10513e343a

View File

@ -1,6 +1,7 @@
module SplitDiff where
import Control.Monad.Free (Free(..))
import Data.Copointed (copoint)
import Diff (Annotated(..))
import Term (Term)
@ -16,3 +17,8 @@ getSplitTerm (SplitReplace a) = a
-- | A diff with only one sides annotations.
type SplitDiff leaf annotation = Free (Annotated leaf annotation) (SplitPatch (Term leaf annotation))
-- | Get the Info from a split diff
getSplitAnnotation :: SplitDiff leaf annotation -> annotation
getSplitAnnotation (Pure patch) = copoint (getSplitTerm patch)
getSplitAnnotation (Free annotated) = annotation annotated