mirror of
https://github.com/github/semantic.git
synced 2024-12-25 07:55:12 +03:00
Add a function to extract the annotation from a SplitDiff.
This commit is contained in:
parent
ea143b6633
commit
10513e343a
@ -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 side’s 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
|
||||
|
Loading…
Reference in New Issue
Block a user